View Single Post
Old 2017-10-17, 23:16   #3
danaj
 
"Dana Jacobsen"
Feb 2011
Bangkok, TH

38C16 Posts
Default

MathWorld is, not surprisingly, not quite right. They mean to say consecutive primes, as "consecutive numbers" is obviously wrong.

The OEIS Wiki has a better page than Mathworld:

https://oeis.org/wiki/Prime_constellations

It separates the idea of a cluster from a constellation. Matt's page starts by talking about the standard triplets but then notes we can also find 3-clusters. These are not consecutive primes.

Code:
# replace ... by your list of a,b,... for p,p+a,p+b,...
# perl -Mntheory=:all -E 'say for sieve_prime_cluster(<from>,<to>, ...);
# e.g. one of Matt's clusters:'
perl -Mntheory=:all -E 'say for sieve_prime_cluster(0,1000,102,246);'

# or this random meaningless one:
perl -Mntheory=:all -E 'say for sieve_prime_cluster(0,1e6, 102,246,384,512,770,896);'
The isprime methods are easy to program in a lot of languages (trivial in Pari/GP for instance). The method in the Perl module finds admissable residues, sieves them, then does final primality tests on the remainders. It's fairly fast for large clusters. It is certainly not unique or the first to do it.
danaj is offline   Reply With Quote