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-10 of 130 results. Next

A061558 The smallest difference of an increasing arithmetic progression of n primes with the minimal possible first term (A007918(n)).

Original entry on oeis.org

0, 1, 2, 6, 6, 30, 150, 1210230, 32671170, 224494620, 1536160080, 1482708889200, 9918821194590, 266029822978920, 266029822978920, 11358256064006271420, 341976204789992332560, 128642760444772214170530, 2166703103992332274919550
Offset: 1

Views

Author

Gennady Gusev, May 17 2001

Keywords

Comments

Apart from the initial term, does this sequence coincide with A113461? - N. J. A. Sloane, Sep 22 2007

Examples

			For n = 10, the smallest difference a(10) = 224494620 with the first term 11 (= A007918(10)) producing an arithmetic progression of 10 primes.
		

Crossrefs

Cf. A007918 (initial terms), A120302 (last terms), A130791 (triangle).

Extensions

a(16) and a(17) from P. Carmody. - Gennady Gusev, Oct 07 2005
a(0) deleted by N. J. A. Sloane, Sep 22 2007
a(18) from Gennady Gusev, Oct 31 2012
a(19) from Wojciech Izykowski, Apr 11 2013

A138751 a(n) = nextprime( p(n)/2 if p(n)=2 (mod 3), 2p(n) else ) = A007918( A138750( A000040( n ))).

Original entry on oeis.org

2, 7, 3, 17, 7, 29, 11, 41, 13, 17, 67, 79, 23, 89, 29, 29, 31, 127, 137, 37, 149, 163, 43, 47, 197, 53, 211, 59, 223, 59, 257, 67, 71, 281, 79, 307, 317, 331, 89, 89, 97, 367, 97, 389, 101, 401, 431, 449, 127, 461, 127, 127, 487, 127, 131, 137, 137, 547, 557, 149
Offset: 1

Views

Author

M. F. Hasler, Mar 28 2008

Keywords

Comments

Composing the map A138750 with A007918 to the left and restricting it to the primes makes it a mapping from primes into primes which is a natural generalization of the Collatz problem to primes. (Looking at parity would not be interesting for primes, so using "mod 3" is the simplest nontrivial generalization.)
The only even prime p=2 is the only fixed point of this map and all odd primes seem to end up in the loop 7 -> 17 -> 11 -> 7, after a number of steps given in A138752.
The sequence A124123 lists the primes which do not occur in the present sequence.
See A138750 for further information.

Examples

			a(1) = nextprime(2/2) = 2, a(2) = nextprime(2*3) = 7, a(3) = nextprime(5/2) = 7.
		

Crossrefs

Programs

  • Mathematica
    A138751[n_]:=With[{p=Prime[n]},NextPrime[If[Mod[p,3]==2,p/2,2p]]];Array[A138751,100] (* Paolo Xausa, Jul 28 2023 *)
  • PARI
    A138751(n) = { n=prime(n); nextprime( if( n%3==2, ceil(n/2), 2*n ))}

Formula

a(n) = A007918(A138750(A000040(n))).

A138752 Number of iterations before prime(n) reaches 7 or 2 under x -> A007918(A138750(x)).

Original entry on oeis.org

0, 1, 2, 0, 1, 4, 2, 7, 5, 3, 20, 16, 6, 6, 4, 4, 21, 23, 19, 17, 17, 15, 7, 5, 7, 5, 28, 22, 26, 22, 22, 20, 18, 18, 16, 20, 16, 14, 6, 6, 8, 59, 8, 8, 6, 29, 27, 25, 23, 25, 23, 23, 27, 23, 21, 19, 19, 21, 19, 17, 19, 17, 19, 17, 17, 15, 13, 11, 9, 11, 9, 60, 58, 54, 11, 9, 7, 30, 28
Offset: 1

Views

Author

M. F. Hasler, Mar 28 2008

Keywords

Comments

As explained in A138751, the map x->A007918(A138750(x)) is a natural generalization of the Collatz map to primes.
The only even prime p=2 is the only fixed point of this map, and all odd primes seem to end up in the loop 7 -> 17 -> 11 -> 7, after a number of steps given in the present sequence.
(It might have been more natural to count the steps until a number is reached for the second time. Depending on which number among {2,7,11,17} is reached first, this would increase the value of a(n) by 1,3,2 resp. 1.)

Examples

			a(1)=a(4)=0 since prime(1)=2 and prime(4)=7 are by definition the values at which counting ends.
a(primepi(4499221))=63337 according to G. Brougnard, cf. Link.
		

Crossrefs

Programs

  • Mathematica
    A138752[n_]:=Length[NestWhileList[NextPrime[If[Mod[#,3]==2,#/2,2#]]&,Prime[n],#!=2&&#!=7&]]-1;Array[A138752,100] (* Paolo Xausa, Jul 28 2023 *)
  • PARI
    A138752(n,c=0) = { if( n==1 & 7==n=prime(n), 0, until( 7==n=nextprime( if( n%3==2, ceil(n/2), 2*n )),c++);c)}

A125266 Number of repetitions in A007918.

Original entry on oeis.org

3, 1, 2, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 4, 2, 6, 4, 6, 8, 4, 2, 4, 2, 4, 14, 4, 6, 2, 10, 2, 6, 6, 4, 6, 6, 2, 10, 2, 4, 2, 12, 12, 4, 2, 4, 6, 2, 10, 6, 6, 6, 2, 6, 4, 2, 10, 14, 4, 2, 4, 14, 6, 10, 2, 4, 6, 8, 6, 6, 4, 6, 8, 4, 8, 10, 2, 10, 2, 6, 4, 6, 8, 4, 2, 4, 12, 8, 4, 8
Offset: 1

Views

Author

Cino Hilliard, Jan 15 2007

Keywords

Comments

Except for the first 2 terms, these numbers are always even. Conjecture: the number 2 occurs infinitely often in this sequence.
Essentially the same as A075526 and A054541. - R. J. Mathar, Jun 15 2008
3 together with A001223. - Omar E. Pol, Nov 01 2013

Examples

			A007918(0) = 2, A007918(1)=2, A007918(2) = 2. So 2 repeats 3 times, giving 3 as the first term in the table.
		

Crossrefs

Programs

  • Mathematica
    Join[{3},Differences[Prime[Range[100]]]] (* Paolo Xausa, Oct 25 2023 *)
  • PARI
    nextprimerep(n) = { local(x,y,y1,c=0); y1=2; for(x=0,n, y=nextprime(x); if(y==y1,c++,y1=y;print1(c",");c=1); ) }

A130791 Triangle read by rows: n-th row is the lexicographically earliest arithmetic progression of n primes beginning with A007918(n).

Original entry on oeis.org

2, 2, 3, 3, 5, 7, 5, 11, 17, 23, 5, 11, 17, 23, 29, 7, 37, 67, 97, 127, 157, 7, 157, 307, 457, 607, 757, 907, 11, 1210241, 2420471, 3630701, 4840931, 6051161, 7261391, 8471621, 11, 32671181, 65342351, 98013521, 130684691, 163355861, 196027031, 228698201, 261369371
Offset: 1

Views

Author

N. J. A. Sloane, Sep 22 2007, Oct 17 2007

Keywords

Comments

If we omit the first row, is this the same triangle as A113460? Equivalently, do A061558 and A113461 agree apart from the initial term? Answer: almost certainly not!

Examples

			Triangle begins:
2
2 3
3 5 7
5 11 17 23
5 11 17 23 29
7 37 67 97 127 157
7 157 307 457 607 757 907
11 1210241 2420471 3630701 4840931 6051161 7261391 8471621
11 32671181 65342351 98013521 130684691 163355861 196027031 228698201 261369371
		

Crossrefs

For common differences see A061558.

Extensions

Extended by Ray Chandler, Sep 22 2007

A171400 Minimal number of editing steps (delete, insert or substitute) to transform the binary representation of n into that of A007918(n), the least prime not less than n.

Original entry on oeis.org

1, 1, 0, 0, 1, 0, 1, 0, 2, 1, 1, 0, 1, 0, 3, 3, 1, 0, 1, 0, 2, 1, 1, 0, 2, 1, 2, 2, 1, 0, 1, 0, 2, 1, 2, 2, 1, 0, 3, 3, 1, 0, 1, 0, 2, 1, 1, 0, 2, 1, 2, 2, 1, 0, 2, 2, 2, 1, 1, 0, 1, 0, 5, 4, 2, 1, 1, 0, 2, 1, 1, 0, 1, 0, 2, 1, 2, 1, 1, 0, 2, 1, 1, 0, 2, 2, 3, 3, 1, 0, 4, 4, 4, 4, 5, 5, 1, 0, 2, 2, 1, 0, 1, 0, 2
Offset: 0

Views

Author

Reinhard Zumkeller, Dec 08 2009

Keywords

Comments

Delete steps are not necessary;
a(n) = 0 iff n is prime: a(A000040(n))=0;
a(A171401(n)) = 1;
A171402 gives smallest numbers m such that a(m)=n: a(A171402(n))=n.

Examples

			n=14, A007918(14)=17: 14==1110->1100->1100->10001==17, 2 subst and 1 ins: a(14)=3;
n=15, A007918(15)=17: 15==1111->1011->1001->10001==17, 2 subst and 1 ins: a(15)=3;
n=16, A007918(16)=17: 16==10000->10001==17, 1 subst: a(16)=1, A171401(8)=16;
n=17, A007918(17)=17: no editing step: a(17)=0;
n=18, A007918(18)=19: 18==10010->10011==19, 1 subst: a(18)=1, A171401(9)=18.
		

Crossrefs

Formula

a(n) = BinaryLevenshteinDistance(n, A007918(n)).

A072681 a(n) = (n - A007917(n)) * (A007918(n) - n).

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 3, 4, 3, 0, 1, 0, 3, 4, 3, 0, 1, 0, 3, 4, 3, 0, 5, 8, 9, 8, 5, 0, 1, 0, 5, 8, 9, 8, 5, 0, 3, 4, 3, 0, 1, 0, 3, 4, 3, 0, 5, 8, 9, 8, 5, 0, 5, 8, 9, 8, 5, 0, 1, 0, 5, 8, 9, 8, 5, 0, 3, 4, 3, 0, 1, 0, 5, 8, 9, 8, 5, 0, 3, 4, 3, 0, 5, 8, 9, 8, 5, 0, 7, 12, 15, 16, 15, 12, 7, 0, 3, 4, 3, 0, 1, 0
Offset: 2

Views

Author

Reinhard Zumkeller, Jul 01 2002

Keywords

Comments

a(n)=0 iff n is prime.
Local maxima occur at interprimes: a(A024675(n)) = A074927(n+1). - Reinhard Zumkeller, Mar 04 2009
Expanding upon the maxima comment, repetitive subset triplets (like 3,4,3) of form (k,k+1,k) occur when the middle value is a square. - Bill McEachen, Apr 14 2025

Crossrefs

Programs

  • Mathematica
    a[n_] := (n - NextPrime[n+1, -1])*(NextPrime[n] - n); Table[a[n], {n, 2, 103}] (* Jean-François Alcover, Jun 14 2013 *)

Formula

a(n) = A064722(n) * A007920(n).
a(n) = A064722(n) * (A072680(n) - A064722(n)).

A120302 Last term of arithmetic progression of primes described in A130791, A007918, A061558.

Original entry on oeis.org

2, 3, 7, 23, 29, 157, 907, 8471621, 261369371
Offset: 1

Views

Author

N. J. A. Sloane, Oct 17 2007

Keywords

Crossrefs

Apart from leading term, agrees with A127781 for many terms. Where is the first difference?

A138757 a(n) = A007918(A138750(n)), that is, least prime > n/2 if n=2 (mod 3), > 2n otherwise.

Original entry on oeis.org

2, 2, 2, 7, 11, 3, 13, 17, 5, 19, 23, 7, 29, 29, 7, 31, 37, 11, 37, 41, 11, 43, 47, 13, 53, 53, 13, 59, 59, 17, 61, 67, 17, 67, 71, 19, 73, 79, 19, 79, 83, 23, 89, 89, 23, 97, 97, 29, 97, 101, 29, 103, 107, 29, 109, 113, 29, 127, 127, 31, 127, 127, 31, 127
Offset: 0

Views

Author

M. F. Hasler, Apr 04 2008

Keywords

Comments

This can be considered as an analog of the Collatz (or 3n+1) map on the set of primes, see A138751 and A138754 for details.
Numbers 0,1,2 go immediately to the unique fixed point 2, all others end up in the cycle 7 -> 17 -> 11 -> 7, after a number of iterations given by A138753(A138757(n))-1 (= A138753(n)-2 if n is prime).

Examples

			a(7) = 17 since 7 = 1 (mod 3), thus A138750(7) = 2*7 = 14, nextprime(14) = 17.
a(11) = 7 since 11 = 2 (mod 3), thus A138750(11) = ceiling(11/2) = 6, nextprime(6) = 7.
		

Crossrefs

Programs

  • Mathematica
    np1[n_]:=Module[{x=Ceiling[n/2]},If[PrimeQ[x],x,NextPrime[x]]]; np2[n_]:= Module[{x=2n},If[PrimeQ[x],x,NextPrime[x]]]; Table[If[Mod[n,3]==2, np1[n], np2[n]],{n,0,70}] (* Harvey P. Dale, Jul 10 2013 *)
  • PARI
    A138757(n)=nextprime(if(n%3==2,(n+1)\2,2*n))

Formula

a(n) = A007918(A138750(n)).
For p prime, a(p) = A138751(A000720(p))

A069224 Numbers n such that n^2 + n + A007918(n+2) is prime.

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 8, 9, 12, 13, 14, 15, 20, 30, 32, 35, 36, 37, 38, 39, 44, 47, 49, 56, 60, 63, 65, 66, 75, 80, 84, 90, 93, 96, 98, 102, 104, 110, 113, 117, 119, 125, 129, 130, 133, 139, 140, 145, 146, 149, 150, 153, 155, 159, 162, 167, 170, 179, 180, 183, 184, 192
Offset: 1

Views

Author

Michael V. Scovetta (mike(AT)scovetta.com), Apr 12 2002

Keywords

Comments

Let K be the number of entries in the sequence less than or equal to M. Then the ratio K/M is nearly monotone decreasing. I do not know if the sequence converges, but if it does, it will be to a number less than 0.30.

Examples

			35 is a term because 35^2 + 35 + 37 = 1297, which is prime.
		

Crossrefs

Cf. A007918.

Programs

  • Magma
    [n: n in [1..200] | IsPrime(n^2 + n + NextPrime(n+1))]; // Vincenzo Librandi, Aug 11 2018
  • Maple
    filter:= select(n -> isprime(n^2+n+nextprime(n+1)), [$1..200]); # Robert Israel, Aug 10 2018
  • Mathematica
    Select[Range[200], PrimeQ[(NextPrime[# + 1] + #^2 + #)] &] (* Vincenzo Librandi, Aug 11 2018 *)
  • PARI
    isok(n) = isprime(n^2 + n + nextprime(n+2)); \\ Michel Marcus, Aug 11 2018
    

Extensions

1 inserted, and definition corrected by Robert Israel, Aug 10 2018
Showing 1-10 of 130 results. Next