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 10 results.

A091666 Difference between prime(n)^2 and the next prime.

Original entry on oeis.org

1, 2, 4, 4, 6, 4, 4, 6, 12, 12, 6, 4, 12, 12, 4, 10, 10, 6, 4, 10, 4, 6, 10, 6, 4, 10, 4, 18, 6, 12, 10, 6, 4, 12, 28, 6, 10, 4, 4, 18, 10, 10, 12, 4, 12, 6, 10, 10, 10, 12, 4, 10, 18, 28, 18, 22, 6, 12, 4, 16, 18, 4, 4, 10, 4, 4, 6, 22, 4, 42, 24, 22, 10, 4
Offset: 1

Views

Author

Pierre CAMI, Jan 27 2004

Keywords

Comments

Conjecturally, a(n) << log^2 n (with constant around 8/e^gamma in the supremum). [Charles R Greathouse IV, Dec 27 2011]
Except for a(2)=2, there are no terms = 2 mod 6 (as p^2+2 = 0 mod 3 for primes p > 3). Also, only 1 and 2 appear once while all other terms may appear (infinitely) many times. [Zak Seidov, Apr 18 2012]

Examples

			prime(3)=5, 5*5=25 for k=4 25+4=29 prime, k=4 is the least k with prime(3)^2 + k prime.
		

Crossrefs

Programs

  • Mathematica
    NextPrime[#^2]-#^2&/@Prime[Range[74]] (* Zak Seidov, Apr 18 2012 *)
  • PARI
    a(n) = my(x=prime(n)^2); nextprime(x)-x; \\ Michel Marcus, Oct 07 2023

Formula

Conjecture: Limit_{N->oo} (Sum_{n=1..N} a(n)) / (Sum_{n=1..N} log(prime(n))) = 2. - Alain Rocchelli, Oct 04 2023

A054270 Largest prime below prime(n)^2 (A001248).

Original entry on oeis.org

3, 7, 23, 47, 113, 167, 283, 359, 523, 839, 953, 1367, 1669, 1847, 2207, 2803, 3469, 3719, 4483, 5039, 5323, 6229, 6883, 7919, 9403, 10193, 10607, 11447, 11867, 12763, 16127, 17159, 18757, 19319, 22193, 22787, 24631, 26561, 27883, 29927, 32029
Offset: 1

Views

Author

Labos Elemer, May 05 2000

Keywords

Comments

For n > 1, the n-1 first primes determine the primes up to a(n). This is how the Sieve of Eratosthenes works. - Jean-Christophe Hervé, Oct 21 2013

Crossrefs

Programs

  • Maple
    seq(prevprime(ithprime(i)^2),i=1..100); # Robert Israel, May 04 2020
  • Mathematica
    NextPrime[Prime[Range[50]]^2,-1] (* Harvey P. Dale, May 19 2016 *)
  • PARI
    a(n) = precprime(prime(n)^2); \\ Michel Marcus, Dec 13 2013

Formula

a(n) = Max[prime q: q < prime(n)^2].
a(n) = prime(A000879(n)) = A000040(A000879(n)). - Jean-Christophe Hervé, Oct 21 2013

A133517 Smallest k such that p(n)^3 - k is prime where p(n) is the n-th prime.

Original entry on oeis.org

1, 4, 12, 6, 4, 18, 4, 2, 4, 10, 2, 2, 4, 14, 10, 4, 22, 38, 2, 28, 14, 12, 4, 22, 24, 4, 14, 24, 2, 10, 14, 4, 16, 12, 10, 2, 12, 30, 10, 16, 48, 18, 10, 20, 30, 42, 2, 14, 4, 26, 18, 10, 2, 10, 4, 4, 16, 12, 2, 34, 24, 58, 30, 4, 38, 6, 14, 14, 10, 12, 36, 6, 2, 24, 68, 4, 6, 26, 10
Offset: 1

Views

Author

Carl R. White, Sep 14 2007

Keywords

Examples

			p(4)=7, 7^3 = 343; for odd k and n > 1, p(n)^r - k is even and thus not prime, so we only need consider even k.
for k = 2: 343 - 2 = 341, which is 11 * 31 and not prime.
for k = 4: 343 - 4 = 339, which is 3 * 113, also not prime.
for k = 6: 343 - 6 = 337, which is prime, so 6 is the smallest number that can be subtracted from 343 to make another prime.
Hence a(4) = 6.
		

Crossrefs

Programs

  • Mathematica
    sk[n_]:=With[{c=Prime[n]^3},c-NextPrime[c,-1]]; Array[sk,80] (* Harvey P. Dale, May 07 2019 *)
  • PARI
    a(n) = {k = 0; while (! isprime(prime(n)^3 - k), k++); return (k);} \\Michel Marcus, Aug 02 2013

A133518 Smallest k such that p(n)^3 + k is prime where p(n) is the n-th prime.

Original entry on oeis.org

3, 2, 2, 4, 30, 6, 6, 4, 30, 2, 12, 18, 6, 24, 14, 14, 12, 10, 16, 2, 6, 4, 2, 14, 54, 6, 4, 18, 4, 2, 30, 26, 56, 10, 24, 12, 24, 10, 30, 2, 18, 6, 26, 24, 14, 28, 18, 10, 14, 10, 12, 24, 16, 6, 18, 2, 20, 6, 4, 12, 4, 6, 10, 2, 6, 14, 16, 4, 18, 10, 14, 14, 16, 24, 4, 12, 32, 16, 50, 12, 2
Offset: 1

Views

Author

Carl R. White, Sep 14 2007

Keywords

Examples

			p(1)=2, 2^3 = 8. for even k, 2^r + k is even and thus not prime, so we only need consider odd k.
for k = 1: 8 + 1 = 9, which is 3^2 and not prime.
for k = 3: 8 + 3 = 11, which is prime, so 3 is the smallest number that can be added to 8 to make a new prime.
Hence a(1) = 3.
		

Crossrefs

Programs

  • Magma
    [NextPrime(p^3)-p^3: p in PrimesUpTo(500)]; // Bruno Berselli, Sep 03 2013
  • Mathematica
    Table[NextPrime[Prime[n]^3] - Prime[n]^3, {n, 100}] (* Bruno Berselli, Sep 03 2013 *)
  • PARI
    a(n) = {k = 0; p3 = prime(n)^3; while (! isprime(p3+k), k++); k;} \\ Michel Marcus, Sep 03 2013
    
  • PARI
    a(n) = {p3 = prime(n)^3; nextprime(p3) - p3;} \\ Michel Marcus, Sep 03 2013
    

A133519 Smallest k such that p(n)^4 - k is prime where p(n) is the n-th prime.

Original entry on oeis.org

3, 2, 6, 2, 2, 2, 24, 14, 18, 2, 8, 8, 2, 2, 12, 2, 2, 24, 24, 38, 2, 8, 2, 54, 12, 2, 12, 12, 44, 18, 14, 18, 12, 32, 12, 24, 38, 14, 12, 12, 54, 2, 50, 8, 32, 8, 12, 14, 24, 8, 8, 2, 2, 12, 18, 30, 50, 12, 2, 24, 12, 2, 32, 2, 84, 12, 8, 12, 8, 74, 14, 18, 2, 20, 24, 14, 2, 14, 14, 2, 18
Offset: 1

Views

Author

Carl R. White, Sep 14 2007

Keywords

Examples

			p(3)=5, 5^4 = 625; for odd k and n > 1, p(n)^r - k is even and thus not prime, so we only need consider even k.
for k = 2: 625 - 2 = 623, which is 7 * 89 and not prime.
for k = 4: 625 - 4 = 621, which is 3^3 * 23, also not prime.
for k = 6: 625 - 6 = 619, which is prime, so 6 is the smallest number that can be subtracted from 625 to make another prime.
Hence a(3) = 6.
		

Crossrefs

Programs

  • Mathematica
    sk[p_]:=Module[{k=1,c=p^4},While[CompositeQ[c-k],k++];k]; sk/@Prime[Range[100]] (* Harvey P. Dale, Nov 19 2023 *)
    Table[With[{c=p^4},c-NextPrime[c,-1]],{p,Prime[Range[100]]}] (* Harvey P. Dale, Nov 20 2023 *)

A133520 Smallest k such that p(n)^4 + k is prime where p(n) is the n-th prime.

Original entry on oeis.org

1, 2, 6, 10, 12, 10, 16, 16, 6, 12, 18, 16, 12, 28, 6, 22, 6, 16, 6, 16, 6, 16, 30, 6, 16, 42, 22, 42, 28, 52, 22, 16, 28, 10, 28, 70, 30, 42, 78, 36, 12, 42, 6, 12, 40, 12, 12, 16, 16, 16, 18, 10, 6, 22, 60, 46, 76, 46, 18, 126, 12, 22, 22, 6, 16, 16, 22, 18, 120, 22, 12, 6, 6, 36
Offset: 1

Views

Author

Carl R. White, Sep 14 2007

Keywords

Examples

			p(2)=3, 3^4 = 81; for odd k and n > 1, p(n)^r + k is even and thus not prime, so we only need consider even k.
for k = 2: 81 + 2 = 83, which is prime, so 2 is the smallest number that can be added to 81 to make a new prime.
Hence a(2) = 2.
		

Crossrefs

Programs

  • Mathematica
    NextPrime[#]-#&/@(Prime[Range[80]]^4) (* Harvey P. Dale, May 17 2015 *)

A133521 Smallest k such that p(n)^5 - k is prime where p(n) is the n-th prime.

Original entry on oeis.org

1, 2, 4, 20, 4, 2, 18, 18, 16, 6, 2, 6, 24, 12, 36, 22, 10, 8, 8, 24, 20, 86, 22, 6, 18, 42, 26, 6, 50, 52, 20, 12, 48, 2, 196, 68, 18, 14, 16, 16, 18, 2, 10, 6, 16, 38, 2, 36, 6, 2, 16, 42, 18, 42, 40, 34, 22, 2, 38, 4, 36, 52, 26, 132, 36, 28, 24, 74, 46, 36, 4, 16, 8, 24, 80, 16
Offset: 1

Views

Author

Carl R. White, Sep 14 2007

Keywords

Examples

			p(10)=29, 29^5 = 20511149; for odd k and n > 1, p(n)^r - k is even and thus not prime, so we only need consider even k.
for k = 2: 20511149 - 2 = 20511147, which is 3 * 23 * 297263 and not prime.
for k = 4: 20511149 - 4 = 20511145, which is 5 * 4102229, also not prime.
for k = 6: 20511149 - 6 = 20511141, which is prime, so 6 is the smallest number that can be subtracted from 20511149 to make another prime.
Hence a(10) = 6.
		

Crossrefs

Programs

  • Mathematica
    #-NextPrime[#,-1]&/@(Prime[Range[80]]^5) (* Harvey P. Dale, Sep 27 2020 *)

A133522 Smallest k such that p(n)^5 + k is prime where p(n) is the n-th prime.

Original entry on oeis.org

5, 8, 12, 4, 2, 6, 20, 22, 8, 8, 12, 22, 26, 30, 20, 20, 74, 52, 22, 26, 4, 22, 6, 42, 40, 8, 58, 44, 42, 8, 40, 6, 36, 28, 2, 28, 6, 4, 20, 14, 2, 12, 8, 46, 2, 40, 10, 4, 110, 12, 18, 44, 42, 6, 24, 20, 8, 28, 46, 2, 18, 6, 60, 36, 24, 2, 18, 4, 24, 48, 6, 30, 6, 6, 22, 6, 2, 6, 2, 40, 2
Offset: 1

Views

Author

Carl R. White, Sep 14 2007

Keywords

Examples

			p(2)=3, 3^5 = 243; for odd k and n > 1, p(n)^r - k is even and thus not prime, so we only need consider even k.
for k = 2: 243 + 2 = 245, which is 5 * 7^2 and not prime.
for k = 4: 243 + 4 = 247, which is 13 * 19, also not prime.
for k = 6: 243 + 6 = 249, which is 3 * 83, also not prime.
for k = 8: 243 + 8 = 251, which is prime, so 8 is the smallest number that can be added to 243 to make another prime.
Hence a(2) = 8.
		

Crossrefs

A062772 Smallest prime larger than square of n-th prime.

Original entry on oeis.org

5, 11, 29, 53, 127, 173, 293, 367, 541, 853, 967, 1373, 1693, 1861, 2213, 2819, 3491, 3727, 4493, 5051, 5333, 6247, 6899, 7927, 9413, 10211, 10613, 11467, 11887, 12781, 16139, 17167, 18773, 19333, 22229, 22807, 24659, 26573, 27893, 29947, 32051
Offset: 1

Views

Author

Labos Elemer, Jul 18 2001

Keywords

Comments

Subsequence of A007491. - Zak Seidov, Apr 30 2015

Examples

			100th prime, 541 immediately follows 529, square of 9th prime.
		

Crossrefs

Cf. A007491. - Zak Seidov, Apr 30 2015

Programs

  • Maple
    with(numtheory): [seq(nextprime(ithprime(w)^2),w=1..100)];
  • Mathematica
    Array[NextPrime[Prime[#]^2] &, 41] (* Michael De Vlieger, Nov 02 2017 *)
  • PARI
    a(n) = { nextprime(prime(n)^2) } \\ Harry J. Smith, Aug 10 2009

Formula

a(n) = A007918(A001248(n)) = A151800(A001248(n)). - Michel Marcus, Jun 24 2014
a(n) = A007491(A000040(n)). - Zak Seidov, Apr 30 2015

A062773 Index of the smallest prime which follows square of n-th prime.

Original entry on oeis.org

3, 5, 10, 16, 31, 40, 62, 73, 100, 147, 163, 220, 264, 284, 330, 410, 488, 520, 610, 676, 706, 812, 887, 1001, 1164, 1253, 1295, 1382, 1424, 1524, 1878, 1977, 2142, 2191, 2490, 2548, 2730, 2916, 3044, 3242, 3437, 3513, 3869, 3946, 4090, 4165, 4628
Offset: 1

Views

Author

Labos Elemer, Jul 18 2001

Keywords

Examples

			100th prime, 541 immediately follows 529, square of 9th prime, a(9)=100.
		

Crossrefs

Programs

  • Mathematica
    PrimePi[NextPrime[#]]&/@(Prime[Range[50]]^2) (* Harvey P. Dale, Apr 12 2023 *)
  • PARI
    a(n) = { primepi(prime(n)^2) + 1 } \\ Harry J. Smith, Aug 10 2009

Formula

a(n) = pi( nextprime( prime(n)^2 ) ).
a(n) = A000720(A062772(n)). - Michel Marcus, Jun 24 2014

Extensions

Offset changed from 0 to 1 by Harry J. Smith, Aug 10 2009
Showing 1-10 of 10 results.