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.

Previous Showing 41-50 of 51 results. Next

A060847 Difference between a nontrivial prime power (A246547) and the previous prime.

Original entry on oeis.org

1, 1, 2, 3, 2, 4, 1, 2, 3, 2, 8, 12, 1, 2, 2, 5, 6, 6, 2, 3, 6, 6, 2, 2, 8, 3, 4, 2, 12, 2, 9, 8, 18, 2, 2, 6, 4, 12, 2, 3, 6, 4, 2, 6, 12, 8, 2, 6, 2, 1, 6, 8, 2, 2, 14, 4, 6, 2, 6, 2, 3, 20, 2, 12, 2, 2, 8, 14, 10, 18, 8, 6, 2, 2, 2, 12, 12, 19, 2, 6, 6, 20, 2, 2, 2, 8, 8, 2, 2, 8, 20, 12, 15, 2, 4
Offset: 1

Views

Author

Labos Elemer, May 03 2001

Keywords

Comments

a(n)=1 only for some powers of 2.

Examples

			78125=5^7 follows 78121, the difference is 4.
		

Crossrefs

Programs

  • Maple
    N:= 10^5: # to consider prime powers <= N
    P:= select(isprime,[2,seq(i,i=3..floor(sqrt(N)),2)]):
    PP:= sort([seq(seq(p^k,k=2..ilog[p](N)),p=P)]):
    map(t -> t - prevprime(t), PP); # Robert Israel, Nov 13 2024
  • Python
    from sympy import primepi, integer_nthroot, prevprime
    def A060847(n):
        def f(x): return int(n+x-sum(primepi(integer_nthroot(x,k)[0]) for k in range(2,x.bit_length())))
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        return (a:=bisection(f,n,n))-prevprime(a) # Chai Wah Wu, Sep 13 2024

Formula

a(n) = A246547(n)-prevprime(A246547(n)) = A246547(n)-A049711(A246547(n)).

A060848 Difference between a nontrivial prime power (A025475) and the next prime.

Original entry on oeis.org

1, 3, 2, 1, 4, 2, 5, 4, 3, 2, 6, 2, 3, 4, 8, 1, 4, 4, 6, 9, 12, 6, 4, 12, 6, 7, 30, 4, 12, 12, 5, 16, 6, 4, 10, 10, 12, 10, 6, 3, 4, 6, 10, 4, 6, 2, 4, 10, 6, 17, 4, 10, 4, 18, 6, 30, 12, 12, 4, 10, 27, 4, 6, 4, 12, 4, 28, 6, 2, 10, 4, 4, 10, 12, 18, 10, 10, 3, 12, 4, 12, 6, 10, 10, 18, 10, 12
Offset: 1

Views

Author

Labos Elemer, May 03 2001

Keywords

Comments

a(n)=1 only for some powers of 2 corresponding to Fermat primes > 3. - Edited by Robert Israel, Jun 03 2021

Examples

			78125=5^7 is followed by 78137, the difference is 12.
		

Crossrefs

Programs

  • Maple
    N:= 10^5: # for prime powers <= N
    S:= {}:
    p:= 1:
    do
      p:= nextprime(p);
      if p^2 > N then break fi;
      S:= S union {seq(p^i,i=2..floor(log[p](N)))}
    od:
    map(t -> nextprime(t)-t, sort(convert(S,list))); # Robert Israel, Jun 03 2021
  • Mathematica
    NextPrime[#]-#&/@Select[Range[100000],PrimePowerQ[#]&&!PrimeQ[#]&] (* Harvey P. Dale, Oct 19 2022 *)

Formula

a(n) = nextprime(A025475(n)) - A025475(n) = A013632(A025475(n)).

A060849 Difference between 2 consecutive primes between which a nontrivial power of prime is found.

Original entry on oeis.org

2, 4, 4, 4, 6, 6, 6, 6, 6, 4, 14, 14, 4, 6, 10, 6, 10, 10, 8, 12, 18, 12, 6, 14, 14, 10, 34, 6, 24, 14, 14, 24, 24, 6, 12, 16, 16, 22, 8, 6, 10, 10, 12, 10, 18, 10, 6, 16, 8, 18, 10, 18, 6, 20, 20, 34, 18, 14, 10, 12, 30, 24, 8, 16, 14, 6, 36, 20, 12, 28, 12, 10, 12, 14, 20, 22, 22
Offset: 1

Views

Author

Labos Elemer, May 03 2001

Keywords

Examples

			59049=3^10 is between 59029 and 59051, so the corresponding term is 59051-59029=22.
		

Crossrefs

Programs

  • PARI
    ispp(n) = isprimepower(n) >= 2; \\ A246547
    lista(nn) = {for (n=1, nn, if (ispp(n), print1(nextprime(n) - precprime(n), ", ")););} \\ Michel Marcus, Mar 23 2020

Formula

a(n) = nextprime(A246547(n)) - prevprime(A246547(n)) = A013633(A246547(n)). [corrected by Michel Marcus, Mar 23 2020]

A097521 Difference between F(n) = 2^(2^n)+1 and nextprime(F(n)) where F(n) is the n-th Fermat Number.

Original entry on oeis.org

2, 2, 2, 6, 2, 14, 12, 50, 296, 74, 642, 980, 1760, 896, 2774, 118112, 44060, 5850
Offset: 0

Views

Author

Cino Hilliard, Aug 27 2004

Keywords

Comments

In the Name, nextprime means A151800, not A007918. - Jeppe Stig Nielsen, Nov 18 2019
a(n) = A129786(n)-1 except in the rare case that F(n) is a prime. - Jeppe Stig Nielsen, Nov 18 2019

Examples

			F(5) = 4294967297. Nextprime(F(5)) = 4294967311.
4294967311 - 4294967297 = 14 the 6th entry in the table.
		

Crossrefs

Programs

  • PARI
    for(n=0,+oo,print1(nextprime(2^(2^n)+2)-(2^(2^n)+1),", ")) \\ Jeppe Stig Nielsen, Nov 18 2019

Formula

a(n) = A013632(A000215(n)). - Michel Marcus, Nov 18 2019

Extensions

More terms with the help of A129786 from Jeppe Stig Nielsen, Nov 18 2019

A121837 Least positive j such that Product_{k=1..n} D(k) + j is prime, where D() are the doublets, A020338.

Original entry on oeis.org

2, 9, 7, 7, 17, 7, 29, 17, 19, 23, 23, 13, 29, 79, 19, 89, 97, 53, 43, 347, 127, 127, 149, 29, 167, 331, 379, 61, 59, 167, 199, 557, 107, 113, 43, 191, 439, 41, 263, 227, 109, 71, 227, 137, 149, 409, 271, 53, 157, 79, 503, 103, 461, 137, 587, 233, 491, 73, 367, 233, 449
Offset: 1

Views

Author

Jason Earls, Aug 28 2006

Keywords

Comments

Is every term for n > 2 always prime?
a(159) = 1. - Michel Marcus, Jan 07 2021
a(n) = 1 for n = 245 and 702 (using ispseudoprime() in PARI). - Michel Marcus, Jan 08 2021

Crossrefs

Programs

  • PARI
    D(n) = eval(Str(n, n)); \\ A020338
    f(n) = prod(k=1, n, D(k)); \\ A121826
    a(n) = my(q=f(n)); nextprime(q+1) - q; \\ Michel Marcus, Jan 07 2021

Formula

a(n) = A013632(A121826(n)). - Michel Marcus, Jan 07 2021

A121842 Difference between n^3 and next prime.

Original entry on oeis.org

2, 1, 3, 2, 3, 2, 7, 4, 9, 4, 9, 30, 5, 6, 5, 14, 3, 6, 7, 4, 9, 16, 3, 30, 5, 4, 3, 4, 9, 2, 11, 12, 3, 14, 9, 24, 7, 18, 5, 14, 7, 6, 5, 24, 9, 2, 31, 14, 5, 10, 3, 10, 3, 14, 13, 18, 5, 28, 9, 12, 23, 10, 3, 2, 3, 2, 5, 16, 9, 2, 19, 2, 25, 6, 3, 16, 3, 6, 5, 4, 9, 16, 13, 2, 19, 4, 3, 4, 9, 14
Offset: 0

Views

Author

Zak Seidov, Aug 29 2006

Keywords

Comments

From Ingham (1937) it follows that there is a prime between x^3 and (x+1)^3 if x is sufficiently large: see A060199 for further details. - M. F. Hasler, Nov 09 2020

Examples

			a(6)=7 because next prime after 6^3=216 is 223 and 223-216=7.
		

Crossrefs

Cf. A060199 (number of primes between consecutive cubes).

Programs

  • Mathematica
    Array[NextPrime[#] - # &[#^3] &, 90, 0] (* Michael De Vlieger, Nov 12 2020 *)
  • PARI
    a(n) = nextprime(n^3) - n^3; \\ Michel Marcus, Oct 10 2013

Formula

a(n) = A013632(n^3) = A013632(A000578(n)). - Michel Marcus, Oct 10 2013

A235431 The smallest positive number that must be added to or subtracted from the sum of the first n primes in order to get a prime.

Original entry on oeis.org

1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3, 4, 3, 4, 1, 2, 5, 2, 1, 4, 1, 4, 1, 2, 3, 4, 5, 2, 3, 2, 5, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 10, 1, 4, 11, 2, 1, 6
Offset: 1

Views

Author

R. J. Cano, Jan 17 2014

Keywords

Comments

The primes in A013918 would have associated a(n)=0 if not for the qualifier "positive" in the definition.
The sum of the first n primes appears to be close to a prime. For illustration, the maximum for a(n) among the first 5 million terms is a(808500) = 218.
See A013916 for the above mentioned indices, numbers n such that the sum of the first n primes is prime. - M. F. Hasler, Jan 20 2014

Examples

			The sum of the first 9 primes is 100, and by adding 1 we get 101. Since 101 is a prime, a(9) = 1.
The sum of the first 10 primes is 129, since 129 - 2 = prime(31) = 127 or 129 + 2 = prime(32) = 131, a(10) = 2.
The sum of the first 129 primes minus 1 is a prime, this is 42468 - 1 = prime(4443), so a(129) = 1.
		

Crossrefs

Programs

  • PARI
    a(n)=my(u=sum(j=1,n,prime(j)),k=1);while(!(isprime(u+k)||isprime(u-k)),k++);k

Formula

Algorithm:
Let S be the sum of the first n primes;
initially, let k=1;
increment k while neither S-k nor S+k is prime;
return a(n)=k.
a(n) = min(A013632(A007504(n)), A049711(A007504(n))). - M. F. Hasler, Jan 20 2014

A289356 Least number k such that n^2 + n + k is prime.

Original entry on oeis.org

2, 1, 1, 1, 3, 1, 1, 3, 1, 7, 3, 5, 1, 9, 1, 1, 5, 1, 5, 3, 1, 1, 3, 5, 1, 3, 7, 1, 9, 7, 7, 5, 5, 1, 3, 17, 29, 3, 1, 7, 17, 1, 5, 9, 7, 11, 17, 11, 5, 9, 1, 5, 11, 17, 1, 3, 11, 1, 11, 1, 11, 11, 1, 17, 17, 7, 1, 5, 11, 1, 3, 1, 5, 5, 7, 1, 5, 1, 1, 3, 1, 11, 17, 5, 11, 11
Offset: 0

Views

Author

Gionata Neri, Jul 03 2017

Keywords

Comments

a(A002384(n)) = 1.
a(A027752(n)) = 3, for n > 2.

Crossrefs

Cf. A002378, A002384, A013632, A027752, A182047 (resulting primes).

Programs

  • Maple
    seq(nextprime(n^2+n)-(n^2+n), n=0..100); # Robert Israel, Jul 05 2017
  • Mathematica
    Table[k = 1; While[! PrimeQ[n^2 + n + k], k++]; k, {n, 0, 85}] (* Michael De Vlieger, Jul 04 2017 *)
  • PARI
    for(n=0,85,k={my(k=1);while(!isprime(n^2+n+k),k++);k;};print1(k", "))

Formula

a(n) = A013632(A002378(n)). - Robert Israel, Jul 05 2017

A309877 a(n) is the smallest number k such that the difference between the next prime greater than k and k equals n.

Original entry on oeis.org

1, 0, 8, 7, 24, 23, 90, 89, 118, 117, 116, 115, 114, 113, 526, 525, 524, 523, 888, 887, 1130, 1129, 1338, 1337, 1336, 1335, 1334, 1333, 1332, 1331, 1330, 1329, 1328, 1327, 9552, 9551, 15690, 15689, 15688, 15687, 15686, 15685, 15684, 15683, 19616, 19615, 19614, 19613, 19612, 19611
Offset: 1

Views

Author

Ilya Gutkovskiy, Aug 21 2019

Keywords

Examples

			+------+------+-----+
| a(n) | next | gap |
|      | prime|     |
+------+------+-----+
|   1  |   2  |  1  |
|   0  |   2  |  2  |
|   8  |  11  |  3  |
|   7  |  11  |  4  |
|  24  |  29  |  5  |
|  23  |  29  |  6  |
|  90  |  97  |  7  |
|  89  |  97  |  8  |
+------+------+-----+
		

Crossrefs

Programs

  • Maple
    N:= 100:
    A:= Vector(N,-1):
    count:= 0: lastp:= 0:
    while count < N do
      p:= nextprime(lastp);
      newvals:= select(t -> A[t]=-1, [$1..min(p-lastp,N)]);
      count:= count+nops(newvals);
      for k in newvals do A[k]:= p-k od;
      lastp:= p;
    od:
    convert(A,list); # Robert Israel, Aug 23 2019
  • Mathematica
    Table[SelectFirst[Range[0, 20000], NextPrime[#] - # == n &], {n, 1, 50}]
    Module[{nn=20000,d},d=Table[{n,NextPrime[n]-n},{n,0,nn}];Table[SelectFirst[d,#[[2]]==k&],{k,50}]][[;;,1]] (* Harvey P. Dale, Mar 23 2025 *)
  • PARI
    a(n) = my(k=0); while(nextprime(k+1) - k != n, k++); k; \\ Michel Marcus, Aug 21 2019

Formula

a(n) = min {k : A013632(k) = n}.

A351728 Primes p such that if q is the next prime, p+A004086(q) and q+A004086(p) are prime.

Original entry on oeis.org

2, 61, 83, 433, 677, 2351, 2399, 2441, 4397, 4457, 4673, 6257, 6367, 6961, 8263, 8713, 8761, 20627, 21391, 21649, 22721, 22871, 23227, 23761, 25111, 25321, 25589, 25609, 25741, 25841, 26597, 26731, 26981, 27179, 27271, 27299, 27367, 27409, 27481, 27961, 28559, 29881, 40609, 40927, 40933, 42197
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Mar 20 2022

Keywords

Comments

For each term p except 2, A013632(p) is divisible by 6.

Examples

			a(3) = 83 is a term because it is prime, the next prime is 89, and 83+98 = 181 and 38+89 = 127 are both prime.
		

Crossrefs

Programs

  • Maple
    revdigs:= proc(n) local L,i; L:= convert(n,base,10);
      add(L[-i]*10^(i-1),i=1..nops(L))
    end proc:
    Primes:= select(isprime, [2,seq(i,i=3..10000,2)]):
    RPrimes:= map(revdigs,Primes):
    Primes[select(i -> isprime(Primes[i]+RPrimes[i+1]) and isprime(RPrimes[i]+Primes[i+1]), [$1..nops(Primes)-1])]:
Previous Showing 41-50 of 51 results. Next