OFFSET
1,1
COMMENTS
This is the k=3 case of the set of sequences "records in a(k,n) = prime(n+k) - prime(n)." The k=1 case is given by A005250 (ncreasing gaps between primes), A000101 [increasing gaps between primes (upper end)] and A002386, which gives lower ends of these gaps. The k=2 case is A031132. The merits of these records are (prime(n+3)-prime(n))/log (prime(n)). The first record merit is 5/log 2 = 16.6096405. The second record merit is 8/log 3 = 16.7672262.
EXAMPLE
a(1) = A031165(1) = prime(4) - prime(1) = 7 - 2 = 5, which is the only odd element of this sequence.
a(2) = A031165(2) = prime(5) - prime(2) = 11 - 3 = 8.
a(3) = A031165(4) = prime(7) - prime(4) = 17 - 7 = 10.
a(4) = A031165(7) = prime(10) - prime(7) = 29 - 17 = 12.
a(5) = A031165(9) = prime(12) - prime(9) = 37 - 23 = 14.
MATHEMATICA
NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ@k, k++ ]; k]; d = 0; p = 1; q = 2; r = 3; s = 5; lst = {}; Do[{p, q, r, s} = {q, r, s, NextPrim[s]}; If[s > d + p, d = s - p; AppendTo[lst, d]; Print[d]], {n, 10^8}] (* Robert G. Wilson v *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Jonathan Vos Post, Jan 22 2006
EXTENSIONS
Corrected and extended by Robert G. Wilson v, Jan 23 2006
STATUS
approved