Euler #21: Amicable Numbers
How can numbers be amicable? Do they go over to each other’s houses? Do they nod at each other while walking down the street? Probably not. But it is an interesting proposition to find them.
How can numbers be amicable? Do they go over to each other’s houses? Do they nod at each other while walking down the street? Probably not. But it is an interesting proposition to find them.
Triangle numbers and beer pong go hand in hand. Finding a highly divisible triangle number could be handy if you had a huge party and wanted to neatly divvy up the cups after a game (ew).
Adding up is fun. It’s even more fun when they’re primes. But, how do we find primes? We use sieves such as the Sieve of Atkin, which is implemented here.
Is that bearded bald guy really Eratosthenes of Cyrene? Who knows? We do know that he devised the prototypical sieve of prime numbers, put to use here.
“Base prime” is a nifty shortcut used here to calculate the least common multiple of a set of numbers. Imagine a giant Venn diagram of overlapping factors.
Composite numbers are sieved out, while prime numbers fall through. Check out this totally amateur implementation of the Sieve of Eratosthenes.