As a treat for Valentine's Day, I have decided to share with you guys a quite lovable maths number pattern. They're called amicable numbers!
\[(220, 284), (1184, 1210), (2620, 2924), (5020, 5564), (6232, 6368), ...\]
\[p.d.(220) = \sum \left \{ 1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110 \right \}= 284\] \[p.d.(284) = \sum \left \{ 1, 2, 4, 71, 142 \right \}= 220\]
If it wasn't immediately clear to you that amicable numbers tend to be large, consider that our sequence (A259180) has its minimum values are 220 and 284, with the next pair just above a thousand. It has big numbers. That shouldn't deter us from making a program to let the computers do all of the work! How could we check for amicable numbers (amicability?) using computer science?
Remember that we should make some test cases, but in this situation, the inputs are up to the programmer. I would suggest giving the computer a range, perhaps a maximum integer to check for amicable numbers up to.
inputs (max value) | expected output |
---|---|
10 | no amicable numbers! |
300 | 220 ♥ 284 |
1300 | 220 ♥ 284, 1184 ♥ 1210 |
-1 | invalid range! |
... | ... |
\[(10744, 10856), (12285, 14595), (17296, 18416), (63020, 76084), (66928, 66992), ...\]
Below I've written some methods that will help us in finding the correct proper divisors of an integer, and then summing them up. Then, we brute-force every numeric pair to a provided limit and print out amicable numbers! Because this sequence is defined, there can be no wrong answers. One downside is, you and I probably don't have access to the computing power necessary to find the next ones!
Back in the tenth century, an Arab mathematician discovered a method for finding some amicable numbers. Finally, a formula! The Thābit ibn Qurra method for finding amicable pairs states the following:
Though the above method is known to work with for only three values of $n$, (2, 4, and 7), it wouldn't be that tough of a challenge to code it up! However, I will leave that up to you. Send your best code snippets for the Qurra method to onealio@onealio.com
Happy Valentine's Day!
\[(67095, 71145), (69615, 87633), (79750, 88730), (100485, 124155), (122265, 139815), (122368, 123152), (141664, 153176), (142310, 168730), ...\]
Bonus link!
http://mathsgear.co.uk/products/amicable-numbers-pair-of-keyrings-nerd-romance
Below I've written some methods that will help us in finding the correct proper divisors of an integer, and then summing them up. Then, we brute-force every numeric pair to a provided limit and print out amicable numbers! Because this sequence is defined, there can be no wrong answers. One downside is, you and I probably don't have access to the computing power necessary to find the next ones!
Back in the tenth century, an Arab mathematician discovered a method for finding some amicable numbers. Finally, a formula! The Thābit ibn Qurra method for finding amicable pairs states the following:
$\texttt{Let: }p=3*2^{n-1}-1$
$\texttt{ }q=3*2^{n-1}$
$\texttt{ }r=9*2^{2n-1}-1$
$\texttt{where }n>1\texttt{ is an integer and }p, q, r\texttt{ are prime numbers, then:}$
$(2^n pq)$ $\texttt{ and }$ $(2^n r)$ $\texttt{ are amicable numbers.}$
Though the above method is known to work with for only three values of $n$, (2, 4, and 7), it wouldn't be that tough of a challenge to code it up! However, I will leave that up to you. Send your best code snippets for the Qurra method to onealio@onealio.com
Happy Valentine's Day!
\[(67095, 71145), (69615, 87633), (79750, 88730), (100485, 124155), (122265, 139815), (122368, 123152), (141664, 153176), (142310, 168730), ...\]
Bonus link!
http://mathsgear.co.uk/products/amicable-numbers-pair-of-keyrings-nerd-romance