Ruth-Aaron Pairs

August 11, 2017

We have an exercise today from the realm of recreational mathematics, based on a video from Numberphile. The two numbers 714 = 2 × 3 × 7 × 17 and 715 = 5 × 11 × 13 have, between them, the first seven prime numbers as their factors (baseball fans will understand the name of this exercise, others will have to watch the video). So the first exercise is to find other pairs of consecutive numbers that have as their factors all and only the first n primes, for some n.

Carl Pomerance, the speaker in the Numberphile video, credits one of his students for first noticing that the sums of the prime factors of 714 and 715 are equal: 2 + 3 + 7 + 17 = 5 + 11 + 13 = 29. So the second exercise is to find other pairs of consecutive numbers whose factors sum to the same number. This exercise can be divided into two parts: numbers where repeating factors are added in to the sum and numbers where only the distinct factors are added in to the sum.

Your task is to complete the three exercises; they will make much more sense if you watch the video. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

Advertisements

Pages: 1 2

2 Responses to “Ruth-Aaron Pairs”

  1. Paul said

    In Python.

    def aaron1(limit=1000):
        lim2 = limit ** 2
        prgen = primegen()
        N = next(prgen) * next(prgen) * next(prgen)
        while N < lim2:
            cand1 = isqrt(N)
            if cand1 * (cand1 + 1) == N:
                yield cand1, cand1 + 1
            N *= next(prgen)
    
    def aaron_rep(limit = 1000):
        lastsum = 2
        for n in range(3, limit):
            newsum = sum(td_factors(n))
            if lastsum == newsum:
                yield n-1, n
            lastsum = newsum
    
    def aaron_uni(limit = 1000):
        lastsum = 2
        for n in range(3, limit):
            newsum = sum(set(td_factors(n)))
            if lastsum == newsum:
                yield n-1, n
            lastsum = newsum
    
    print(list(aaron1()))
    print(list(aaron_rep()))
    print(list(aaron_uni()))
    
  2. Zack said

    The first exercise seemed quite time consuming, so I focused on the other two.
    Code: https://app.box.com/s/0o1p2xrt4x8uf68h5j547x1cywh4dtfq
    If the main() function is run with distinct set to true, it only checks for distinct factors. The second parameter of the function has to do with the highest number to check.

    Sample output:
    julia> main(true)
    5, 6 5
    24, 25 5
    49, 50 7
    77, 78 18

    julia> main(false)
    5, 6 5
    8, 9 6
    15, 16 8
    77, 78 18

    The last number corresponds to the factor sum.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: