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-3 of 3 results.

A295746 Distinct second differences in the sequence of primes in order of appearance.

Original entry on oeis.org

1, 0, 2, -2, -4, 4, 10, -10, 8, -8, 6, 16, -12, -16, 12, -14, -20, 28, -28, -6, 22, 14, 20, 26, -26, -22, -24, 24, -18, 18, 32, -32, -30, 40, -40, 30, -38, -34, 46, 38, 50, -46, 34, 68, -64, -44, 58, -58, -48, -50, 48, 52, -54, 44, -52, 36, -42, 56
Offset: 1

Views

Author

Edward Bernstein, Nov 29 2017

Keywords

Comments

A036263 excluding repeated terms. - Iain Fox, Nov 30 2017

Examples

			From _Jon E. Schoenfield_, Jan 15 2018: (Start)
The first several primes and their 1st and 2nd differences are as follows:
.
   k prime(k)  1st difference    2nd difference
  -- --------  --------------  -------------------
   1     2
                 3 -  2 = 1
   2     3                     2 - 1 =  1 (new)
                 5 -  3 = 2
   3     5                     2 - 2 =  0 (new)
                 7 -  5 = 2
   4     7                     4 - 2 =  2 (new)
                11 -  7 = 4
   5    11                     2 - 4 = -2 (new)
                13 - 11 = 2
   6    13                     4 - 2 =  2 (repeat)
                17 - 13 = 4
   7    17                     2 - 4 = -2 (repeat)
                19 - 17 = 2
   8    19                     4 - 2 =  2 (repeat)
                23 - 19 = 4
   9    23                     6 - 4 =  2 (repeat)
                29 - 23 = 6
  10    29                     2 - 6 = -4 (new)
                31 - 29 = 2
  11    31
.
and the 2nd differences that are not repeats of 2nd differences encountered earlier are, in order of appearance, 1, 0, 2, -2, -4, ..., i.e., the terms of this sequence. (End)
		

Crossrefs

Cf. A036263. A295973 are the primes associated with the new second differences.

Programs

  • Maple
    P:= select(isprime, [2,seq(i,i=3..10^6,2)]):
    DP:= P[2..-1]-P[1..-2]:
    DDP:= DP[2..-1]-DP[1..-2]:
    ListTools:-MakeUnique(DDP); # Robert Israel, Jan 15 2018
  • Mathematica
    DeleteDuplicates@ Differences[Prime@ Range[10^4], 2] (* Michael De Vlieger, Dec 09 2017 *)
  • PARI
    first(n) = { my(res = vector(n), i=3, j=3); res[1]=1; res[2]=0; while(i<=n, my(d=prime(j+2)+prime(j)-2*prime(j+1)); if(!setsearch(Set(res), d), res[i]=d; i++); j++); res; } \\ Iain Fox, Nov 30 2017

A316791 a(n) is the least prime p such that the second forward difference of three consecutive primes p, q and r is n = (p - 2q + r)/2.

Original entry on oeis.org

3, 5, 29, 503, 137, 109, 1063, 1931, 521, 7951, 1949, 1667, 5743, 2969, 1321, 15817, 9547, 28349, 45433, 20807, 15679, 113837, 43793, 19603, 40283, 25469, 40637, 156151, 79697, 34057, 282487, 134507, 552401, 770663, 31393, 188021, 480203, 461707, 281429, 1078241, 265619, 637937
Offset: 0

Views

Author

Keywords

Comments

Inspired by A295973.
Except for the first three primes {2, 3, 5}, all sfds are even.
The only other sfd which is not covered by this sequence is when the primes are {2, 3, 5} which results in an sfd of 1.
Except for an sfd of 0 or 1, all values of sfd occur infinitely often.
As an example, sfd=2 for p = 5, 11, 17, 19, 41, 43, 79, 83, 101, 107, 127, 163, ..., .

Examples

			a(0) = 3 since the three consecutive primes {3, 5, 7} have an sfd of 0;
a(1) = 5 since the three consecutive primes {5, 7, 11} have an sfd of 2;
a(2) = 29 since the three consecutive primes {29, 31, 37} have an sfd of 4;
a(3) = 503 since the three consecutive primes {503, 509, 521} have an sfd of 6;
a(4) = 137 since the three consecutive primes {137, 139, 149} have an sfd of 8; etc.
		

Crossrefs

Programs

  • Mathematica
    p = 2; q = 3; r = 5; t[_] := 0; While[p < 1100000, d = p - 2q + r; If[ t[d] == 0, t[d] = p]; p = q; q = r; r = NextPrime@ r]; Array[ t[2#] &, 42, 0]
  • PARI
    a(n) = my(p=2, q=3); while ((p - 2*q + nextprime(q+1))/2 != n, p=q; q=nextprime(q+1)); p; \\ Michel Marcus, Mar 08 2023

A316792 a(n) is the least prime p such that the second forward difference of three consecutive primes p, q and r is n = -(p - 2q + r)/2.

Original entry on oeis.org

3, 7, 23, 1531, 139, 113, 523, 1069, 887, 6397, 1129, 3137, 5351, 2971, 1327, 14107, 9973, 19333, 84871, 16141, 15683, 73189, 31907, 28229, 35617, 35677, 44293, 43331, 107377, 34061, 221327, 134513, 31397, 480209, 173359, 332317, 933073, 736279, 265621, 843911, 404851, 155921
Offset: 0

Views

Author

Keywords

Comments

Inspired by A295973.
Except for the first three primes {2, 3, 5}, all sfds are even.
The only other sfd which is not covered by this sequence is when the primes are {2, 3, 5} which results in an sfd of 1.
Except for an sfd of 0 or 1, all values of sfd occur infinitely often.
As an example, sfd = -2 for p = 7, 13, 31, 37, 61, 67, 73, 97, 103, 157, 193, 223, 271, 277, 307, ..., .

Examples

			a(0) = 3 since the three consecutive primes {3, 5, 7} have an sfd of 0;
a(1) = 7 since the three consecutive primes {7, 11, 13} have a sfd of -2;
a(2) = 23 since the three consecutive primes {23, 29, 31} have a sfd of -4;
a(3) = 1531 since the three consecutive primes {1531, 1543, 1549} have an sfd of -6;
a(4) =  since the three consecutive primes {} have an sfd of -8; etc.
		

Crossrefs

Programs

  • Mathematica
    p = 2; q = 3; r = 5; t[_] := 0; While[p < 1000000, d = p - 2q + r; If[ t[d] == 0, t[d] = p]; p = q; q = r; r = NextPrime@ r]; Array[ t[-2#] &, 42, 0]
  • PARI
    a(n) = my(p=2, q=3); while ((p - 2*q + nextprime(q+1))/2 != -n, p=q; q=nextprime(q+1)); p; \\ Michel Marcus, Mar 08 2023
Showing 1-3 of 3 results.