This site is supported by donations to The OEIS Foundation.



(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)



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).


Table of n, a(n) for n=1..22.


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.


(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;








        rec=c; P=p;

        for(i=1, c,


        print1("\n"c": "P", "p));


          c=2; a=1,





          rec=c; P=p;

          for(i=1, c,


          print1("\n"c": "P", "p));


          c=2; a=0,







p=q; q=nextprime(q+1);

if(q>z, z+=10^9; print1("*"));




Cf. A000040, A001223, A036263, A228850, A228851.

Sequence in context: A296300 A224470 A168247 * A186703 A054248 A038108

Adjacent sequences:  A229053 A229054 A229055 * A229057 A229058 A229059




James G. Merickel, Sep 16 2013



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

License Agreements, Terms of Use, Privacy Policy .

Last modified March 17 00:40 EDT 2018. Contains 300543 sequences. (Running on oeis4.)