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.
In Python.
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.