OFFSET
1,1
COMMENTS
If the counting numbers 1, 2, 3, ... are written out sequentially such that one unit is moved in a given direction each time a new number is written and such that the direction is reversed if and only if a prime number is reached, these are the primes that lie directly below the number 1.
Comments from N. J. A. Sloane, Dec 21 2019: (Start)
Let p(k) = k-th prime, Delta p(k) = p(k+1)-p(k). The sequence contains those primes q such that
Sum_{k odd, p(k+1) <= q} Delta p(k) = 1 + Sum_{k even, p(k+1) <= q} Delta p(k).
The boustrophedon path described in the first comment can be drawn as follows (it is very similar to the path in A330339):
-2.-1| 0..1..2..3..4..5..6..7..8..
----------------------------------
.....|.1..2
.....|.3
.....|....4..5
.....|.7..6
.....|....8..9.10.11
.....|......13.12
.....|.........14.15.16.17
.....|............19.18
.....|...............20.21.22.23
.....|......29.28.27.26.25.24
.....|.........30.31
37.36|35.34.33.32
...
The primes that fall in column 0 make up the sequence.
Thanks to Walter Trump for pointing out that this sequence is very similar to the Boustrophedon Primes sequence of A330339, and for correcting an omission in an earlier version of these comments.
The close relationship between the two sequences is demonstrated by the fact that the Boustrophedon Primes occur exactly when A330545 is 0, whereas the primes in the present sequence occur exactly when A330545 is 1 or 2.
Yet another way to relate the two sequences is to say that the present sequence gives all the primes > 2 in columns 1 and 2 of the triangle in A330339.
(End)
The primes (other than 2) occur only in even-numbered columns: primes congruent to 3 mod 4 occur in columns congruent to 0 mod 4, and primes congruent to 1 mod 4 occur in columns congruent to 2 mod 4. See the "Notes" link for proof. In particular, a(n) == 3 mod 4.- N. J. A. Sloane, Jan 04 2020
Frank Stevenson's data seems to suggest that a(n) is roughly growing like n^c where c is about 2.74. - N. J. A. Sloane, Dec 31 2019
LINKS
Giovanni Resta, Table of n, a(n) for n = 1..28850 (first 846 terms from Robert G. Wilson v)
Frank Stevenson, Table of n, a(n) for n=1..163010
Frank Stevenson, Log-log histogram of first 163010 terms.
Walter Trump, The boustrophedon path as far as the prime 1741. This covers the primes 3 through 1663 in the sequence (see the red dots). The rows are horizontal, alternately directed to the right and to the left.
Walter Trump, The boustrophedon path as far as the prime 1741, drawn as a zig-zag. This also covers the primes 3 through 1663 in the sequence. The rows slope downwards, alternately directed to the right and to the left.
Walter Trump, The boustrophedon path as far as the prime 4999. This covers the primes 3 through 4703 in the sequence (see the red dots). The rows are horizontal, alternately directed to the right and to the left.
MATHEMATICA
With[{s = Differences@ Prime@ Range[10^5]}, Prime[1 + Position[Array[Total@ Take[s, {1, #, 2}] - Total@ Take[s, {2, #, 2}] &, Length@ s], 1][[All, 1]] ] ]
PROG
(PARI) my(a=2, n=1, pp=2); forprime(p=3, 47000000, n++; a+= (-1)^(n+1)*(p-pp); if(a==1, print1(p, ", ")); pp=p) \\ Hugo Pfoertner, Dec 23 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Samuel B. Reid, Feb 07 2017
STATUS
approved