cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-6 of 6 results.

A330339 Boustrophedon primes: write the numbers 0, 1, 2, 3, ... in a triangle on a square grid in the boustrophedon manner, ending a row when a prime is reached; sequence lists primes that appear in the zeroth column.

Original entry on oeis.org

37, 53, 89, 113, 3821, 3989, 4657, 28661, 29021, 41641, 41669, 44249, 50909, 56053, 57041, 57301, 133981, 16501361, 46178761, 47633441, 47633477, 47722049, 47736121, 47774621, 47803477, 47810209, 47835013, 47835341, 47854969, 47862413, 47865017, 49448573, 49448617
Offset: 1

Views

Author

N. J. A. Sloane, Dec 17 2019, following a suggestion from Eric Angelini. a(5) and a(6) were found by Walter Trump. a(7)-a(17) from N. J. A. Sloane, Dec 17 2019

Keywords

Comments

Eric Angelini's illustration shows the first 19 rows of the triangle. Each row ends when a prime is reached, and the next row starts directly under this prime but moves in the opposite direction.
The extended illustration from Walter Trump resembles a giant ski run.
Hans Havermann's plots of A330545, linked here, extend Walter Trump's graph to 4*10^8 rows (probably the longest ski run in the world). Only the turns are shown, and the illustration has been turned sideways.
A330545(k) = 0 iff prime(k) is a term of the present sequence. In a sense A330545 and the simpler A330547 are the more fundamental sequences and show the connection between the present problem and the ordinary primes and their alternating sums.
Note that because primes > 2 are odd, a prime can only appear in column 0 at the end of a row that is moving towards the left. A prime appearing in a row moving to the right will always appear in an odd-numbered column (and in particular, not in the zero column).
Furthermore the column number mod 4 uniquely determines the residue class of primes mod 4 in that column. If the column number is 0,1,2,3 mod 4 then the primes in that column are 1,3,3,1 respectively (see the "Notes" link). In particular, a(n) == 1 mod 4. - N. J. A. Sloane, Jan 04 2020
Note that the primes > 2 in column one and two are the primes in A282178.
Note on the links: The illustrations from Angelini and Trump show all the terms 0,1,2,3,4,..., while those of Havermann and Sloane just show the primes (as in A330545).

Crossrefs

A330546 gives the list of indices i such that a(n) = prime(i).
A127596 is another sequence with a similar flavor.
Not to be confused with A000747 = Boustrophedon transform of primes.

Extensions

More terms from Hans Havermann, Dec 17 2019

A330547 a(1)=2; thereafter a(n) = a(n-1) + (-1)^(n+1)*(prime(n)-prime(n-1)) (where prime(k) denotes the k-th prime).

Original entry on oeis.org

2, 1, 3, 1, 5, 3, 7, 5, 9, 3, 5, -1, 3, 1, 5, -1, 5, 3, 9, 5, 7, 1, 5, -1, 7, 3, 5, 1, 3, -1, 13, 9, 15, 13, 23, 21, 27, 21, 25, 19, 25, 23, 33, 31, 35, 33, 45, 33, 37, 35, 39, 33, 35, 25, 31, 25, 31, 29, 35, 31, 33, 23, 37, 33, 35, 31, 45, 39, 49, 47, 51, 45, 53, 47, 53, 49, 55, 47, 51, 43, 53, 51, 61, 59, 65, 61
Offset: 1

Views

Author

N. J. A. Sloane, Dec 19 2019

Keywords

Comments

There are several equivalent definitions:
a(n) = (-1)^(n+1)*(prime(n) + 2*(Sum_{i=1..n-1} (-1)^i*prime(n-i)));
a(n) = (-1)^n*(prime(n) - 2*A008347(n)) for n >= 1;
a(n) = A330545(n) if n is odd, a(n) = A330545(n)-1 if n is even;
generating function = P(-x)*(x+1)/(x-1), where P(x) = 2*x + 3*x^2 + 5*x^3 + ... = Sum_{k>=1} prime(k)*x^k is the g.f. for the primes.
Note that the recurrence closely resembles that of A330545, but is slightly simpler. Hans Havermann's graphs of A330545, linked here, also essentially apply to the present sequence.
This sequence ties together A330339, A330545, A008347, and the primes.
Just as A330545 describes the boustrophedon path that generates the "Boustrophedon Primes" in A330339, the present sequence can also be regarded as defining a boustrophedon path with a slightly different rule, as follows. Write the numbers 0, 1, 2, 3, ... in a triangle on a square grid in the boustrophedon manner, ending a row when a prime is reached, and starting the next row in the opposite direction, but displaced by one square in that direction:
-1.0.1.2.3..4..5..6..7..8..9.
-----------------------------
...0 1 2
.....3
.......4 5
.....7 6
.......8 9 10 11
........13 12
...........14 15 16 17
..............19 18
.................20 21 22 23
...
Since all primes>2 are odd, here the odd primes only appear in odd-number4d columns (and in particular there are no primes in column 0).
In fact the primes (other than 2) occur only in odd-numbered columns: primes congruent to 3 mod 4 occur in columns congruent to 1 mod 4, and primes congruent to 1 mod 4 occur in columns congruent to 3 mod 4. See the "Notes" link for proof. - N. J. A. Sloane, Jan 04 2020
It would be nice to know something about the asymptotic growth of this sequence. The usual estimates for the primes do not seem to produce anything useful.
For large n, the graphs of A330545 and A330547 are essentially identical.
Based on the first 10^12 terms, it appears that lim sup |a(n)| is about n^(2/3). This estimate is based on the plots given in A330545 by Sloane, Trump (the first plot), Havermann (the first plot), and Stevenson (all three plots).- N. J. A. Sloane, Jan 21 2020
Conjecture. Let k be an integer and X_k be the set of all n such that (-1)^n*a(n)=2k-1. If a, b are integers and a<>0, then X_k contains infinitely many terms of the arithmetic progression {a*n+b: n integer}. - M. Farrokhi D. G., Nov 12 2023

Crossrefs

Programs

  • Maple
    f:=n-> (-1)^(n+1)*(ithprime(n)+2*add((-1)^i*ithprime(n-i),i=1..n-1));
    [seq(f(n),n=1..400)];
  • Mathematica
    a[1]=2; a[n_]:= a[a]=a[n-1]+ (-1)^(n+1)*(Prime[n]-Prime[n-1]);Table[a[n],{n,86}] (* James C. McMahon, Dec 18 2023 *)

A127596 Numbers k such that 1 + Sum_{i=1..k-1} A001223(i)*(-1)^i = 0.

Original entry on oeis.org

2, 4, 14, 22, 28, 233, 249, 261, 488, 497, 511, 515, 519, 526, 531, 534, 548, 562, 620, 633, 635, 2985, 3119, 3123, 3128, 3157, 4350, 4358, 4392, 4438, 4474, 4484, 4606, 4610, 4759, 5191, 12493, 1761067, 2785124, 2785152, 2785718, 2785729, 2867471
Offset: 1

Views

Author

Manuel Valdivia, Apr 03 2007

Keywords

Comments

Or, with prime(0) = 1, numbers k such that Sum_{i=0..k-1} (prime(i+1)-prime(i))*(-1)^i = Sum_{i=0..k-1} (A008578(i+1)-A008578(i))*(-1)^i = 0.
There are 313 terms < 10^7, 846 terms < 10^8, 1161 terms < 10^9.

Examples

			1 - A001223(1) = 1 - 1 = 0, hence 2 is a term.
1 - A001223(1) + A001223(2) - A001223(3) = 1 - 1 + 2 - 2 = 0, hence 4 is a term.
		

Crossrefs

Cf. A001223 (differences between consecutive primes), A008578 (prime numbers at the beginning of the 20th century), A000101 (increasing gaps between primes, upper end), A002386 (increasing gaps between primes, lower end).
Cf. A282178 (prime(a(n))), A330545, A330547.

Programs

  • Mathematica
    S=0; Do[j=Prime[n+1]; i=Prime[n]; d[n]=j-i; S=S+(d[n]*(-1)^n); If[S+1==0, Print[Table[j|PrimePi[j]|S+1]]], {n,1,10^7,1}]
  • PARI
    {m=10^8; n=1; p=1; e=1; s=0; while(nKlaus Brockhaus, Apr 29 2007 */

Extensions

Edited by Klaus Brockhaus, Apr 29 2007

A282178 Primes for which the sum of all preceding odd-indexed prime gaps is exactly one greater than the sum of all preceding even-indexed prime gaps.

Original entry on oeis.org

3, 7, 43, 79, 107, 1471, 1579, 1663, 3491, 3547, 3659, 3691, 3719, 3779, 3823, 3851, 3947, 4079, 4583, 4679, 4703, 27271, 28643, 28663, 28711, 29023, 41603, 41651, 41999, 42443, 42787, 42899, 44263, 44279, 45971, 50599, 133979, 28335623
Offset: 1

Views

Author

Samuel B. Reid, Feb 07 2017

Keywords

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

Crossrefs

Cf. A001223, A330339 (Boustrophedon primes), A330545, A330547, A278603.
The indices of these primes are given by A127596.

Programs

  • 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]] ] ]
  • 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

A330546 List of k such that prime(k) is an element of A330339.

Original entry on oeis.org

12, 16, 24, 30, 530, 550, 630, 3122, 3156, 4356, 4360, 4604, 5214, 5688, 5784, 5812, 12494, 1061284, 2785150, 2867484, 2867488, 2872440, 2873242, 2875406, 2877026, 2877426, 2878822, 2878838, 2879978, 2880406, 2880546, 2969918, 2969922, 2969952, 2970792, 3009218
Offset: 1

Views

Author

N. J. A. Sloane, Dec 17 2019

Keywords

Comments

Since all primes > 2 are odd, every term here is even.

Examples

			A330339(1) = 37 = prime(12), so a(1) = 12.
		

Crossrefs

Extensions

More terms from Hans Havermann, Dec 17 2019

A330554 Union of 2, A282178, and A330339.

Original entry on oeis.org

2, 3, 7, 37, 43, 53, 79, 89, 107, 113, 1471, 1579, 1663, 3491, 3547, 3659, 3691, 3719, 3779, 3821, 3823, 3851, 3947, 3989, 4079, 4583, 4657, 4679, 4703, 27271, 28643, 28661, 28663, 28711, 29021, 29023, 41603, 41641, 41651, 41669, 41999, 42443, 42787, 42899, 44249, 44263, 44279, 45971, 50599, 50909, 56053, 57041
Offset: 1

Views

Author

N. J. A. Sloane, Dec 22 2019

Keywords

Comments

Equivalently, primes that occur in columns 0, 1, or 2 of the triangle in A330339. [Corrected by Walter Trump, Dec 23 2019]
The asymptotic behavior of A282178 and A330339 is a mystery. It is not even known if they are infinite. They are closely related. A282178 contains primes == 3 mod 4, and A330339 primes == 1 mod 4. Perhaps by combining them in this way some properties will become more visible.

Crossrefs

Showing 1-6 of 6 results.