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.

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

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

Original entry on oeis.org

2, 2, 3, 2, 5, 4, 7, 6, 9, 4, 5, 0, 3, 2, 5, 0, 5, 4, 9, 6, 7, 2, 5, 0, 7, 4, 5, 2, 3, 0, 13, 10, 15, 14, 23, 22, 27, 22, 25, 20, 25, 24, 33, 32, 35, 34, 45, 34, 37, 36, 39, 34, 35, 26, 31, 26, 31, 30, 35, 32, 33, 24, 37, 34, 35, 32, 45, 40, 49, 48, 51, 46, 53, 48, 53, 50, 55, 48, 51, 44, 53
Offset: 1

Views

Author

N. J. A. Sloane, Dec 17 2019

Keywords

Comments

a(n) is the column of the Boustrophedon triangle in A330339 that contains prime(n).
If a(n) = 0 then p = prime(n) is a term of A330339, and n is a term of A330546.
Since this has a simple recurrence, it is the key to understanding A330339. However, note that this sequence in turn can be simply expressed in terms of the classic sequence A008347:
a(n) = prime(n) + 1 - 2 * A008347(n) if n is even,
a(n) = 2 * A008347(n) - prime(n) if n is odd.
The sequence that ties all these sequences together is A330547 (q.v.).
First negative term is a(146) = -2.
Note on the links: The illustrations from Angelini and Trump show all the terms 0,1,2,3,4,... (as in A330339), while those of Havermann, Sloane, and Stevenson just show the primes.
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). - N. J. A. Sloane, Jan 04 2020
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 below by Sloane, Trump (the first plot), Havermann (the first plot), and Stevenson (all three plots). - N. J. A. Sloane, Jan 21 2020

Crossrefs

Programs

Formula

G.f.: G(-x)*(x+1)/(x-1), where G(x) = 2*x + 2*x^2 +3*x^3 + 4*x^4 + 7*x^5 + ... is the g.f. for A014692, {prime(n) - (n-1): n >= 1}.

Extensions

Keyword nonn changed to sign by Hans Havermann, Dec 27 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 *)

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

A332939 The number of steps to return to the origin for a walk on a 2D square grid where the walk changes direction to move as close as possible toward the origin after it has taken a prime number of steps; backtracking on its previous step is not allowed.

Original entry on oeis.org

0, 6, 18, 74, 110, 200, 268, 380, 574, 662, 828, 932, 1020, 1134, 1440, 1614, 1734, 1760, 1878, 1954, 2142, 2252, 2394, 2560, 2622, 2672, 2694, 2720, 2802, 2862, 3534, 3702, 3802, 3934, 4020, 4104, 4250, 4462, 4798, 5070, 5530, 5698, 5850, 5870, 5940, 6132, 6222, 6316, 6372
Offset: 0

Views

Author

Scott R. Shannon, Mar 02 2020

Keywords

Comments

Consider a walk on a 2D square grid which starts at the origin and may step in either the positive or negative x and y directions. The walk always continues in the direction of its last step until it has taken a number of steps equal to a prime number. The walk may then change to one of the four available directions so it subsequently moves as closely as possible toward the origin, the only restriction being it cannot choose the direction that will backtrack over its previous step. If the walks' location after a prime number of steps is exactly on one of the axes or on a 45-degree diagonal between the axes then it may choose either of the two equivalent directions as its next step, excluding backtracking.
Given these rules this sequence lists the number of steps the walk has taken when it returns to the origin. All terms are even due to the prime 3 being at relative coordinates (2,1) from the origin, and as all subsequent odd numbers are a multiple of two units away from 3 in the y direction an odd number can never have a zero y coordinate.
For a walk of 100 millions steps the walk returns to the origin 165960 times. The furthest distance from the origin is approximately 207.8 units, after step 20831533. The minimum steps between two origin visits is 6, which occurs at the beginning of the walk, from the first step to the sixth step. The maximum steps between origin visits is 7247, which occurs between steps 41331290 and 41338537.

Examples

			a(0) = 0 as the walk is at the origin after zero steps.
a(1) = 6 as from the origin the walk steps right until the number of steps it takes equals the first prime 2. After one more step upward the total steps equals the next prime 3. Two steps left reaches 5 steps, and then one step down back to the origin, taking 6 steps in all. The first step can be in either of the four symmetrically equivalent directions without changing the total steps back to the origin.
.
          5 -<- 4 -<- 3
          |           |
          \/          /\
          |           |
          * ->- 1 ->- 2   where * is the origin
.
a(2) = 18 as after the sixth step to the origin the walk continues down one more step reaching 7 steps, four steps right reaching 11 steps, two steps up to reach 13 steps, four steps left reaching 17 steps, then one step down back to the origin, giving 18 steps in all.
.
.        17 -<- 16 -<- 15 -<- 14 -<- 13
          |                          |
          \/                         /\
          |                          |
          *(6)                       12
          |                          |
          \/                         /\
          |                          |
          7 ->- 8 ->- 9  ->- 10 ->- 11   where * is the origin and previous step 6.
.
		

Crossrefs

Showing 1-6 of 6 results.