The legendary baseball player Babe Ruth1 hit an unseen lifetime record of 714 home runs. This record stood until April 8, 1974, when it was surpassed by Hank Aaron2's record-breaking 715th home run. Carl Pomerance — mathematician at the University of Georgia at the time Aaron broke Ruth's record — introduced a new concept in mathematics based on this event. The inspiration came when a student of one of Pomerance's colleagues noticed that the sums of the prime factors of 714 and 715 are equal. He therefore defined a Ruth-Aaron pair as a pair of consecutive natural numbers $$(n, n + 1)$$ such that the sums of the prime factors of $$n$$ and $$n + 1$$ are equal.

Babe Ruth
Ruth in 1918, his penultimate year with the Red Sox.
Hank Aaron
Hank Aaron with the Braves in 1960.

Each positive integer $$n \in \mathbb{N_0}$$ can be written as a product of prime numbers. \[\begin{eqnarray}10 &=& 2 \times 5\\12 &=& 2 \times 2 \times 3\\13 &=& 13\\100 &=& 2 \times 2 \times 5 \times 5 \end{eqnarray}\] This decomposition in prime factors is unique3, except for the order of the prime factors. The pair $$(714, 715)$$ is a Ruth-Aaron pair as \[\begin{eqnarray}714 &=& 2 \times 3 \times 7 \times 17\\715 &=& 5 \times 11 \times 13\end{eqnarray}\] and $$2 + 3 + 7 + 17 = 29 = 5 + 11 + 13$$. The pair $$(9, 10)$$ is not a Ruth-Aaron pair as $$2 + 5 \not= 3 + 3$$.

Assignment

Example

>>> isPrime(2)
True
>>> isPrime(6)
False
>>> isPrime(12)
False

>>> primeFactors(12)
[2, 2, 3]
>>> primeFactors(17)
[17]
>>> primeFactors(18)
[2, 3, 3]

>>> isRuthAaron(5, 6)
True
>>> isRuthAaron(10, 11)
False
>>> isRuthAaron(15, 16)
True
>>> isRuthAaron(8281, 8280)
False

Resources