After Hank Aaron hit his 715th home run and passed Babe Ruth’s total of 714, Carl Pomerance noticed that the union of the prime factors of the numbers (
and
) comprises all of the prime numbers up to 17.
He told a colleague that he found an interesting property of the two numbers, and when the colleague posed the problem to a class, a student observed that the sums of the prime factors of these two consecutive numbers were equal—in this case, 29. Prof. Pomerance and colleagues named numbers with this property “Ruth-Aaron numbers.”*
Write a function to classify numbers in this way. In computing sums, include only the unique factors. If a number is the lesser of a Ruth-Aaron pair, return ‘R’. If it is the greater number, return ‘A’. If multiple pairs overlap, return ‘RA’ for numbers that can serve as either the lesser or greater. If the number is not part of a Ruth-Aaron pair, return ‘X’.
*The story continues in a Numberphile video on this topic, and I highly recommend that you watch it. Go for the number theory and stay for the life lessons!
Solution Stats
Problem Comments
2 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers27
Suggested Problems
-
500 Solvers
-
881 Solvers
-
63 Solvers
-
110 Solvers
-
479 Solvers
More from this Author321
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
We don't need to have all primes up until n, just the equal sum of the prime factors of two sequential numbers. 77 and 78 are Ruth-Aaron Numbers because 7+11 == 2 + 3 + 13. 7*11 = 77 and 2*3*13 = 78. Only a number will be given as input. If it does not belong to a pair, return 'X,' or else If the lowest number of the pair is given (e.g., 77), your code should return R; if the highest is given, return A (e.g., 78). And if the number can be both, return RA.
PS: The numberphile video is great but doesn't really help.
True, the video doesn't help in solving the problem. My problem description has everything you need to do that. However, a much more important point from that video is how what started as a joke for Carl Pomerance ended up changing his career.