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

A331620 Records of A058249: (Smallest prime >= 2^n) - (largest prime <= 2^n).

Original entry on oeis.org

2, 4, 6, 12, 14, 18, 30, 46, 74, 84, 102, 114, 120, 150, 192, 242, 306, 370, 414, 570, 790, 800, 888, 924, 1024, 1152, 1310, 1790, 2262, 2754, 3472, 6270, 6458, 9334, 12628, 14200, 16406, 18050, 18358, 18492, 19852, 23180, 28730, 32592, 33524, 38696, 39774, 40944, 45444, 46408, 49624, 54704, 60740
Offset: 1

Views

Author

Robert G. Wilson v, Jan 22 2020

Keywords

Crossrefs

Cf. A058249.

A038804 Difference between largest n-digit prime and smallest (n+1)-digit prime.

Original entry on oeis.org

4, 4, 12, 34, 12, 20, 28, 18, 70, 52, 26, 50, 66, 58, 48, 124, 6, 14, 90, 50, 218, 36, 140, 264, 136, 208, 202, 540, 346, 68, 60, 70, 70, 604, 92, 226, 124, 192, 60, 138, 228, 146, 138, 84, 18, 154, 74, 226, 66, 208, 444, 558, 348, 322, 132, 596, 372, 308, 160, 168
Offset: 1

Views

Author

Keywords

Comments

Records: 4, 12, 34, 70, 124, 218, 264, 540, 604, 670, 754, 1182, ..., . - Robert G. Wilson v, Jan 23 2020

Examples

			7 = greatest prime with 1 digit, 11 next smallest prime with 2 digits so a(1)=4.
97 = greatest prime with 2 digits, 101 next smallest prime with 3 digits so a(2)=4.
		

Crossrefs

Programs

  • Mathematica
    (NextPrime[#]-NextPrime[#,-1])&/@(10^Range[100])  (* Harvey P. Dale, Mar 23 2011 *)

Formula

a(n) = A033873(n) + A033874(n). - Zak Seidov, Sep 13 2016

Extensions

Corrected and edited by Patrick De Geest, Nov 06 2004

A059959 Distance of 2^n from its nearest prime neighbor and in case of a tie, choose the smaller.

Original entry on oeis.org

-1, 0, 1, 1, -1, 1, 3, 1, -1, 3, 3, -5, 3, 1, 3, -3, -1, 1, -3, 1, 3, 9, 3, -9, 3, -35, 5, -29, -3, 3, -3, 1, 5, 9, -25, 31, 5, -9, -7, 7, -15, 21, 11, -29, -7, 55, -15, -5, -21, -69, 27, -21, -21, -5, 33, -3, 5, -9, 27, 55, -33, 1, 57, 25, -13, 49, 5, -3, 23, 19, -25, -11, -15, -29, 35, -33, 15, -11, -7, -23, -13, -17, -9, 55, -3, 19
Offset: 0

Views

Author

Labos Elemer, Mar 02 2001

Keywords

Examples

			n=19, 2^19=524288, prevprime(524288)=524287, nextprime(524288)=524309, so min{21,1}=1=a(19).
		

Crossrefs

Programs

  • Maple
    with(numtheory): [seq(min(nextprime(2^i)-2^i, 2^i-prevprime(2^i)), i=2..100)];
  • Mathematica
    f[n_] := Block[{k = 0}, While[ !PrimeQ[2^n -k] && !PrimeQ[2^n +k], k++]; If[ PrimeQ[2^n -k], k, -k]]; Array[f, 70, 0] (* Robert G. Wilson v, Mar 14 2006 and modified Jan 12 2024 *)

Formula

a(n) = A000079(n) - A117387(n).

Extensions

Signs added by Robert G. Wilson v, Mar 14 2006

A338155 (Smallest prime >= 3^n) - (largest prime <= 3^n).

Original entry on oeis.org

0, 4, 6, 4, 10, 6, 24, 10, 6, 22, 36, 74, 30, 10, 18, 124, 44, 20, 70, 16, 60, 6, 52, 30, 34, 22, 42, 48, 144, 30, 20, 104, 122, 90, 50, 12, 52, 18, 140, 156, 72, 126, 126, 42, 68, 90, 98, 100, 66, 74, 50, 174, 30, 38, 126, 72, 30, 378, 102, 176, 108, 130
Offset: 1

Views

Author

A.H.M. Smeets, Oct 25 2020

Keywords

Comments

Size of prime gap containing the number 3^n, for n > 1.
From Gauss's prime counting function approximation, the expected gap size should be approximately n*log(3), however, the observed values seem to be closer to n*log(8.72) ~ n*log(3^2) = n*A016632.

Crossrefs

Cf. A058249 (for 2^n), A338419 (for 5^n), A338376 (for 6^n), A038804 (for 10^n).

Programs

  • Mathematica
    a[1] = 0; a[n_] := First @ Differences @ NextPrime[3^n, {-1, 1}]; Array[a, 60] (* Amiram Eldar, Oct 30 2020 *)
  • PARI
    a(n) = if (n==1, 0, nextprime(3^n) - precprime(3^n)); \\ Michel Marcus, Oct 25 2020

Formula

a(n) = A013598(n) + A013604(n) for n > 1.

A338376 (Smallest prime >= 6^n) - (largest prime <= 6^n).

Original entry on oeis.org

2, 6, 12, 6, 30, 14, 22, 18, 32, 12, 94, 54, 52, 18, 98, 66, 84, 18, 36, 18, 30, 138, 80, 96, 30, 142, 36, 80, 52, 26, 78, 64, 126, 138, 94, 136, 162, 276, 110, 162, 206, 94, 78, 324, 186, 128, 118, 56, 102, 390, 78, 90, 18, 62, 94, 108, 220, 100, 336, 618
Offset: 1

Views

Author

A.H.M. Smeets, Oct 26 2020

Keywords

Comments

Size of prime gap containing the number 6^n, for n > 1.
From Gauss's prime counting function approximation, the expected gap size should be approximately n*log(6), however, the observed values seem to be closer to n*log(36) = n*A016659.
The arithmetic mean of a(n)/n for the terms 1..1000 is 3.605 ~ 2*log(6).

Crossrefs

Cf. A058249 (2^n), A338155 (3^n), A338419 (5^n), A038804 (10^n).

Programs

  • Mathematica
    a[n_] := First @ Differences @ NextPrime[6^n, {-1, 1}]; Array[a, 60] (* Amiram Eldar, Oct 30 2020 *)
  • PARI
    a(n) = my(pw=6^n); nextprime(pw+1) - precprime(pw-1); \\ Michel Marcus, Oct 27 2020

Formula

a(n) = A013607(n) + A013600(n).

A338419 (Smallest prime >= 5^n) - (largest prime <= 5^n).

Original entry on oeis.org

0, 6, 14, 12, 16, 10, 16, 66, 42, 10, 26, 70, 58, 14, 46, 86, 18, 114, 72, 74, 78, 72, 74, 96, 78, 14, 50, 76, 78, 130, 110, 286, 164, 170, 424, 154, 70, 132, 336, 162, 160, 90, 400, 342, 144, 36, 208, 108, 284, 98, 138, 216, 20, 66, 132, 504, 320, 120, 354
Offset: 1

Views

Author

A.H.M. Smeets, Oct 25 2020

Keywords

Comments

Size of prime gap containing the number 5^n, for n > 1.
From Gauss's prime counting function approximation, the expected gap size should be approximately n*log(5), however, the observed values seem to be closer to n*log(25) = n*A016648.
The arithmetic mean of a(n)/n for the terms 2..500 is 3.220 ~ 2*log(5) = A016648.

Crossrefs

Cf. A058249 (2^n), A338155 (3^n), A338376 (6^n), A038804 (10^n).

Programs

  • Mathematica
    a[1] = 0; a[n_] := First @ Differences @ NextPrime[5^n, {-1, 1}]; Array[a, 60] (* Amiram Eldar, Oct 30 2020 *)
  • PARI
    a(n) = if (n==1, 0, my(pw=5^n); nextprime(pw+1) - precprime(pw-1)); \\ Michel Marcus, Oct 27 2020

Formula

a(n) = A013599(n) + A013605(n) for n > 1.

A340707 a(n) = (prevprime(2^n) + nextprime(2^n))/2 - 2^n where prevprime(n) = A151799(n) and nextprime(n) = A151800(n).

Original entry on oeis.org

0, 1, -1, 2, 0, 1, -2, 3, 2, -2, 0, 8, 12, -8, -7, 14, -1, 10, 2, 4, 6, -3, 20, -2, 5, -5, -27, 4, -16, 5, 5, 4, -8, 11, 13, -8, -19, 8, -36, 3, 2, -14, -5, 2, -3, -55, -19, -6, 14, -54, -13, -53, 63, -26, 38, -2, 21, 38, -30, 7, 39, 2, -23, 41, 2, -8, 5, 5, -5, -110
Offset: 2

Views

Author

Hugo Pfoertner, Jan 29 2021

Keywords

Comments

a(n) > 0 if the difference nextprime(2^n) - 2^n = A013597(n) is greater than the difference 2^n - previousprime(2^n) = A013603(n).

Examples

			a(4) = -1: 2^4 = 16, (13 + 17 - 32)/2 = -1;
a(5) = 2: 2^5 = 32, (31 + 37 - 64)/2 = 2;
a(6) = 0: 2^6 = 64, (61 + 67 - 128)/2 = 0.
		

Crossrefs

Programs

  • Maple
    a:= (p-> (nextprime(p)+prevprime(p))/2-p)(2^n):
    seq(a(n), n=2..75);  # Alois P. Heinz, Jan 29 2021
  • Mathematica
    Array[(NextPrime[2^#] + NextPrime[2^#, -1] - 2^(# + 1))/2 &, 60, 2] (* Michael De Vlieger, Aug 07 2022 *)
  • PARI
    for(k=2,71,my(p2=2^k,pp=precprime(p2),pn=nextprime(p2));if(print1((pp+pn-2*p2)/2", ")))

Formula

a(n) = (A013597(n) - A013603(n))/2.
a(A226178(n)) = 0.

Extensions

Name made more precise by Peter Luschny, Aug 08 2022

A060271 Difference between smallest prime following and largest prime preceding 2*(n-th prime).

Original entry on oeis.org

2, 2, 4, 4, 4, 6, 6, 4, 4, 6, 6, 6, 4, 6, 8, 4, 14, 14, 6, 10, 10, 6, 4, 6, 4, 12, 12, 12, 12, 4, 6, 6, 6, 4, 14, 14, 4, 14, 6, 10, 6, 8, 4, 6, 8, 4, 10, 6, 8, 4, 4, 12, 8, 4, 12, 18, 18, 6, 10, 6, 6, 10, 4, 12, 12, 10, 12, 4, 10, 10, 8, 10, 6, 8, 4, 8, 14, 10, 12, 10, 10, 14, 4, 14, 4, 4, 20, 8
Offset: 1

Views

Author

Labos Elemer, Mar 23 2001

Keywords

Examples

			For n = 1: prime(1) = 2, 2*prime(1) = 4 is between 3 and 5, their difference is 2 = a(1).
For n = 6: prime(6) = 13, 2*prime(6) = 26 is between 23 and 29 and their difference is 6 = a(6).
		

Crossrefs

Programs

  • Maple
    with(numtheory): [seq(nextprime(2*ithprime(j))-prevprime(2*ithprime(j)),j=1...256)];
  • Mathematica
    dsplp[n_]:=Module[{np=2Prime[n]},NextPrime[np]-NextPrime[np,-1]]; Array[ dsplp,90] (* Harvey P. Dale, Mar 20 2013 *)
  • PARI
    a(n) = {my(m = 2*prime(n)); nextprime(m+1) - precprime(m-1);} \\ Amiram Eldar, Feb 08 2025

Extensions

Offset changed to 1 and a(1) prepended by Amiram Eldar, Feb 08 2025

A092507 (Smallest prime >= 2^n) + (largest prime <= 2^n).

Original entry on oeis.org

2, 4, 8, 18, 30, 68, 128, 258, 508, 1030, 2052, 4092, 8192, 16400, 32792, 65520, 131058, 262172, 524286, 1048596, 2097156, 4194312, 8388620, 16777210, 33554472, 67108860, 134217738, 268435446, 536870858, 1073741832, 2147483616
Offset: 0

Views

Author

Jorge Coveiro, Apr 05 2004

Keywords

Comments

For n=0 we just take a(0)=2, the least prime >= 2^0, as there is no prime <= 2^0. - Robert Israel, Nov 01 2018

Crossrefs

Programs

  • Maple
    [2, seq( (nextprime(2^x-1)+prevprime(2^x+1)),x=1..20)]; # Corrected by Robert Israel, Nov 01 2018
  • Mathematica
    PrevPrim[n_] := Block[{k = n - 1}, While[ !PrimeQ[k], k-- ]; k]; NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; Table[PrevPrim[2^n+1] + NextPrim[2^n-1], {n, 31}] (* Robert G. Wilson v, Apr 14 2004 *)

Formula

a(n) = A014210(n) + A014234(n) for n >= 2. - Robert Israel, Nov 01 2018

Extensions

More terms from Robert G. Wilson v, Apr 14 2004
Showing 1-9 of 9 results.