The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A229056 Record lengths of strings of alternating-size differences between neighboring primes. 2
2, 6, 8, 13, 16, 18, 19, 20, 21, 26, 28, 29, 31, 33, 34, 35, 36, 39, 40, 43, 45, 52 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
This represents the number of differences in sequence that alternate larger and smaller, so the number of consecutive primes directly involved is 1 larger, with the primes on either end of these strings indirectly involved. The choice not to start this sequence with a(2)=6 is only convention (See A228850). A228850 and A228851 contain the smaller and larger prime, respectively, for each value here, and the first of these contains a fuller explanation in Comments.
The values 8, 29 and 33 arise in ties of records (determined by a simple modification of the below program), twice each for the latter two, and the five pairs of terminal primes for these are (401, 449), (9950911, 9951343), (25782257, 25782683), (38397529, 38398177) and (66410677, 66411151).
Further terms not expected to be found with current resources, with a search extending one order of magnitude larger in the values at the companion sequences of end-primes (at time of submission).
LINKS
EXAMPLE
The record at the prime 7 is 2 (by convention), and the difference preceding is 2. From there the differences are 4, 2, 4, 2, 4, 6, ... (primes 11, 13, 17, 19, 23, 29, ...). So, 6 differences alternate before termination with the 2-4-6 triple.
PROG
(PARI) /* This program produces this sequence's elements followed by the elements of A228850 and A228851, and includes asterisks for each billion searched. */
{
\\ The variable a is a parity marker. \\
\\ c is the length of the string. \\
\\ D is the most recent difference. \\
\\ d is the new difference. \\
p=5; q=7; c=2; D=2; a=0; rec=0; z=10^9;
while(1,
d=q-p;
if(c>1,
if((a+c)%2,
if(d>D,
c++,
if(c>rec,
rec=c; P=p;
for(i=1, c,
P=precprime(P-1));
print1("\n"c": "P", "p));
if(d<D,
c=2; a=1,
c=1)),
if(d<D,
c++,
if(c>rec,
rec=c; P=p;
for(i=1, c,
P=precprime(P-1));
print1("\n"c": "P", "p));
if(d>D,
c=2; a=0,
c=1))),
if(d!=D,
c=2;
if(d>D,
a=0,
a=1)));
p=q; q=nextprime(q+1);
if(q>z, z+=10^9; print1("*"));
D=d)
}
CROSSREFS
Sequence in context: A358970 A224470 A168247 * A186703 A054248 A038108
KEYWORD
nonn
AUTHOR
James G. Merickel, Sep 16 2013
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 12 18:22 EDT 2024. Contains 372494 sequences. (Running on oeis4.)