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

A054271 Difference between prime(n)^2 and the previous prime.

Original entry on oeis.org

1, 2, 2, 2, 8, 2, 6, 2, 6, 2, 8, 2, 12, 2, 2, 6, 12, 2, 6, 2, 6, 12, 6, 2, 6, 8, 2, 2, 14, 6, 2, 2, 12, 2, 8, 14, 18, 8, 6, 2, 12, 12, 2, 6, 6, 20, 2, 2, 8, 8, 2, 2, 8, 12, 2, 6, 8, 8, 12, 20, 12, 2, 20, 18, 2, 6, 14, 2, 8, 12, 8, 2, 6, 6, 12, 6, 18, 30, 12, 12, 18, 2, 8, 12, 24, 2, 2, 6, 14, 6
Offset: 1

Views

Author

Labos Elemer, May 05 2000

Keywords

Comments

From Jean-Christophe Hervé, Oct 22 2013: (Start)
Contains only even numbers, except the first term.
Even integers of the form 3*k+1 (or equivalently integers of form 6*k+4) never appear because prime(n)^2 = 3*k+1 = 1 (mod 3), and prime(n)^2 - (3*k+1) is multiple of 3.
Conjecture: every other even integer appears in the sequence an infinite number of times. (End)

Examples

			From _Zak Seidov_, Feb 20 2012: (Start)
n=4 and prime(4)^2=49, preceded by prime(15)=47, so a(4)=49-47=2;
n=97 and prime(97)^2=509^2=259081, preceded by prime(22765)=259033, so a(97)=259081-259033=48. (End)
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=Module[{n2=n^2},n2-NextPrime[n2,-1]]; f/@Prime[Range[90]] (* Harvey P. Dale, Oct 19 2011 *)
  • PARI
    a(n) = my(p=prime(n)); p^2 - precprime(p^2); \\ Michel Marcus, Feb 27 2023

Formula

a(n) = prime(n)^2 - precprime(prime(n)^2), where precprime(x) is the largest prime less than x. [Corrected by Jean-Christophe Hervé, Oct 21 2013]

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

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 *)

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

Showing 1-7 of 7 results.