Hot math: twin and sexy prime numbers

Just recently I discovered that there’s something called sexy prime numbers. I read about twin primes but hadn’t heard the other term before. The concept is pretty simple: take a prime number and check whether the next prime minus the first one results in a certain number, e.g. 2 for twin primes or 6 for sexy primes. This post presents a simple solution to calculate arbitrary combinations of prime number pairs, triplets, etc.

The Eclipse project with the code for this post can be downloaded as tar.gz or zip. You can browse the code online here.

Continue reading →