Prime Numbers

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.

Euler #12: Highly Divisible Triangular Number

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).

Euler #10: Summation of Primes

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.

Euler #7: 10001st Prime

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.

Euler #5: Smallest Multiple

“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.

Euler #3: Largest Prime Factor

Composite numbers are sieved out, while prime numbers fall through. Check out this totally amateur implementation of the Sieve of Eratosthenes.