Ruth-Aaron Pairs
A Ruth–Aaron pair consists of two consecutive integers (e.g. 714 and 715) for which the sums of the distinct prime factors of each integer are equal. These types of pairs were named by Carl Pomerance, uga math professor, after a student noted that 714 and 715 had this characteristic. 714 was the number of career homeruns hit by the Yankee legend Babe Ruth, while 715 was the number of career homeruns hit by Brave legend Hank Aaron in 1974, thus surpassing Ruth's all time home run record which had stood for almost 40 years.
To start, we must be able to calculate the sum of the prime factors of a given number, which means we must be able to determine whether or not a factor is prime. For this, we could either write our own code or conduct a quick Google search - I opted for the latter and found the SymPy library which has an isprime() function which can be seen in my own function, pf_sum().
Using this function to find the sum of the prime factors of a given argument we are able to cycle through each given tuple by taking them in as a list using *args in the function input. For python, the first argument detailing how many tuples will follow is irrelevant, however it is kept to ensure continuity in copying and pasting test cases. The for loop in ruthaaron() loops through these tuples contained in the args variable (which is a list due to the asterisk in the input field), comparing the sum of the prime factors of the numbers in each tuple to determine if the pair is a Ruth-Aaron pair.
Using this function to find the sum of the prime factors of a given argument we are able to cycle through each given tuple by taking them in as a list using *args in the function input. For python, the first argument detailing how many tuples will follow is irrelevant, however it is kept to ensure continuity in copying and pasting test cases. The for loop in ruthaaron() loops through these tuples contained in the args variable (which is a list due to the asterisk in the input field), comparing the sum of the prime factors of the numbers in each tuple to determine if the pair is a Ruth-Aaron pair.