Tuesday, 10 July 2018

A Decade to Remember

A decade to remember:

25301     25303     25307     25309

A decade can be defined as:
1. a period of ten years
2. a set, series, or group of ten, in particular
I'll define a decade on the number line as consisting of any group of ten numbers, differing only in their units digits, with the first member ending in 0 and the final member ending in 9. For example, the numbers 40, 41, 42, 43, 44, 45, 46, 47, 48 and 49 would be an example of such a decade. In any decade, only those numbers ending in 1, 3, 7 or 9 can be prime.

The question I asked myself was: in how many decades are all four possible primes in fact prime? In the earlier example, the first three members (41, 43 and 47) are prime but 49 is composite.

The reason I'm interested is that today (being 25300 days old) I've entered a decade (25300 to 25309) that contains four prime numbers (25301, 25303, 25307 and 25309). As it turns out, such decades are infrequent. There are only 22 of them in the range from 0 to 31720. The reason I stopped at 31720 is that the decade from 31720 to 31729 contains four primes (31721, 31723, 31727 and 31729). Thus out of a total of 3172 decades, only 22 contain four primes. This is slightly under 0.7%.

The following SAGE program that I wrote is meant to identify all decades containing four primes up to 31,720:
INPUT
primes=list(prime_range(1,31720))
for p in range(3,len(primes)):
   if primes[p]-primes[p-1]==2 and primes[p-1]-primes[p-2]==4 and primes[p-2]-primes[p-3]==2:
            print primes[p-3], primes[p-2], primes[p-1],primes[p] 
OUTPUT
5 7 11 13
11 13 17 19
101 103 107 109
191 193 197 199
821 823 827 829
1481 1483 1487 1489
1871 1873 1877 1879
2081 2083 2087 2089
3251 3253 3257 3259
3461 3463 3467 3469
5651 5653 5657 5659
9431 9433 9437 9439
13001 13003 13007 13009
15641 15643 15647 15649
15731 15733 15737 15739
16061 16063 16067 16069
18041 18043 18047 18049
18911 18913 18917 18919
19421 19423 19427 19429
21011 21013 21017 21019
22271 22273 22277 22279
25301 25303 25307 25309
All I can do is enjoy the novelty because it will be long time until I encounter the next decade. Day number 31720 is 6420 days away or 17.577 years. I'll be 87 years old, if I survive that long. In fact, the length of the gap between this prime quadruple and the next sets a record compared to all previous gaps. The gap between 25309 (the p+8 member of the present quadruple) and 31721 (the p member of the next quadruple) is 6412. Here is a list of the gaps (with records shown in bold):
Gap between 101 and 19 is 82
Gap between 191 and 109 is 82
Gap between 821 and 199 is 622
Gap between 1481 and 829 is 652
Gap between 1871 and 1489 is 382
Gap between 2081 and 1879 is 202
Gap between 3251 and 2089 is 1162
Gap between 3461 and 3259 is 202
Gap between 5651 and 3469 is 2182
Gap between 9431 and 5659 is 3772 
Gap between 13001 and 9439 is 3562
Gap between 15641 and 13009 is 2632
Gap between 15731 and 15649 is 82
Gap between 16061 and 15739 is 322
Gap between 18041 and 16069 is 1972
Gap between 18911 and 18049 is 862
Gap between 19421 and 18919 is 502
Gap between 21011 and 19429 is 1582
Gap between 22271 and 21019 is 1252
Gap between 25301 and 22279 is 3022 
Gap between 31721 and 25309 is 6412 
Here is the SAGE code that I used to generate the gaps (output is shown above):
INPUT
primes=list(prime_range(1,32000))
quadruples=[]
for p in range(2,len(primes)):
    if primes[p]-primes[p-1]==2 and primes[p-1]-primes[p-2]==4 and primes[p-2]-primes[p-3]==2:
        for x in range(0,4):
            quadruples.append(primes[p-x])
ordered=sorted(quadruples)
for p in range(2,len(ordered)):
    print "Gap between",ordered[4*p],"and",ordered[4*p-1],"is",Integer(ordered[4*p])-Integer(ordered[4*p-1])

No comments:

Post a Comment