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.

A056206 Smallest prime p such that p + 2^n is also a prime.

Original entry on oeis.org

2, 3, 3, 3, 3, 5, 3, 3, 7, 11, 7, 5, 3, 17, 37, 3, 3, 29, 3, 53, 7, 17, 67, 11, 43, 41, 97, 29, 3, 11, 3, 11, 61, 17, 79, 53, 31, 29, 7, 23, 97, 71, 277, 29, 7, 59, 127, 5, 61, 191, 193, 101, 37, 5, 163, 3, 97, 131, 577, 131, 151, 197, 193, 29, 13, 131, 709, 3, 61
Offset: 0

Views

Author

Labos Elemer, Oct 06 2000

Keywords

Examples

			n=9, 512 + {2,3,5,7,11,...} = {514,515,519,523,...} = {2*257, 5*103, 11*47, 3*173, 523=prime, ...}. The smallest suitable prime is 11 and it gives 523 = 512 + 11. So a(9)=11.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; local o, p; o, p:=2^n, 2;
          while not isprime(o+p) do p:= nextprime(p) od; p
        end:
    seq(a(n), n=0..75);  # Alois P. Heinz, Mar 20 2023
  • Mathematica
    Table[i=1; While[!PrimeQ[2^n+(p=Prime[i])],i++]; p,{n,0,72}] (* Jayanta Basu, May 23 2013 *)

Formula

a(n) = Min{p|p+2^n=q, both p and q are primes}.

Extensions

a(0) from Jayanta Basu, May 23 2013

A057663 Primes p such that p + 2^p is also a prime.

Original entry on oeis.org

3, 5, 89, 317, 701
Offset: 1

Views

Author

Labos Elemer, Oct 16 2000

Keywords

Comments

Different from A056206, where, e.g., at n=89, 89 is not minimal, A056206(89)=29 and not 89.
a(6) > 27479. - Ralf Stephan, Oct 23 2002
Intersection of A000040 and A052007. - Iain Fox, Nov 08 2017
a(6) > 678561. - Iain Fox, Nov 08 2017
Every term other than 3 is congruent to 5 (mod 6). - Arkadiusz Wesolowski, Nov 14 2017
These terms satisfy phi(k + 2^k) = phi(k) + 2^k, where phi is A000010, the Euler totient function. Conjecture: this sequence gives all numbers k that satisfy the condition phi(k + 2^k) = phi(k) + 2^k. - Juri-Stepan Gerasimov, May 23 2019

Examples

			q=3, 2^3 + 3 = 11 a prime.
		

Crossrefs

Programs

  • Magma
    [p: p in PrimesUpTo(1000) | IsPrime(2^p+p) ] // Vincenzo Librandi, Aug 07 2010
    
  • Mathematica
    Select[Prime@ Range[10^3], PrimeQ[# + 2^#] &] (* Michael De Vlieger, Nov 08 2017 *)
  • PARI
    lista(nn) = forprime(p=3, nn, if(ispseudoprime(p + 2^p), print1(p, ", "))) \\ Iain Fox, Nov 13 2017
    
  • Sage
    [n for n in (1..1000) if is_prime(n) and is_prime(2^n+n)] # G. C. Greubel, May 24 2019

A057673 Smallest prime p such that |2^n - p| is a prime.

Original entry on oeis.org

3, 5, 2, 3, 3, 3, 3, 19, 5, 3, 3, 19, 3, 13, 3, 19, 17, 13, 5, 19, 3, 19, 3, 37, 3, 61, 5, 79, 89, 3, 41, 19, 5, 79, 41, 31, 5, 31, 107, 7, 167, 31, 11, 67, 17, 139, 167, 127, 59, 139, 71, 139, 47, 379, 53, 67, 5, 13, 137, 607, 107, 31, 167, 409, 59, 79, 5, 19, 23, 19, 71, 577, 107
Offset: 0

Views

Author

Labos Elemer, Oct 19 2000

Keywords

Comments

The absolute value is relevant only for first two terms, 2^0-a(0) = 1-3 = -2, 2^1-a(1) = 2-5 = -3. According to Goldbach's conjecture, every even number > 2 is the sum of two primes, which implies that for all further terms, a(n) < 2^n. - M. F. Hasler, Jan 13 2011

Examples

			n=7, 2^n=128. The smallest terms subtracted from 128 resulting in a prime are 1,15,19,... Neither 1 nor 15 are primes but 19 is a prime. It gives 109=128-19, so a(n)=19.
		

Crossrefs

Analog of A056206. Cf. A056208, A057662.

Programs

  • Mathematica
    f[n_] := Block[{p = 2}, While[! PrimeQ[2^n - p], p = NextPrime@ p]; p]; Array[f, 60, 0]
  • PARI
    A057673(n)=forprime( p=1,default(primelimit), ispseudoprime(abs(2^n-p))& return(p))

Extensions

Offset corrected and initial term added by M. F. Hasler, Jan 13 2011

A057662 Smallest prime q such that q + 2^prime(n) is a prime, where prime(n) is the n-th prime.

Original entry on oeis.org

3, 3, 5, 3, 5, 17, 29, 53, 11, 11, 11, 29, 71, 29, 5, 5, 131, 197, 3, 11, 29, 23, 89, 29, 359, 149, 239, 239, 881, 281, 29, 3449, 197, 683, 389, 683, 101, 1283, 83, 191, 1181, 197, 5, 71, 107, 101, 71, 4001, 1433, 251, 431, 29, 1361, 89, 509, 83, 2459, 941, 101, 197
Offset: 1

Views

Author

Labos Elemer, Oct 16 2000

Keywords

Examples

			For n = 6, prime(6) = 13, 8192 + 17 = 8209 is a prime but 8192 + 2, 8182 + 3, ..., 8192 + 13 are not, so a(6) = 17.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{m = 2^Prime[n], q = 2}, While[!PrimeQ[q + m], q = NextPrime[q]]; q]; Array[a, 60] (* Amiram Eldar, Mar 13 2025 *)
  • PARI
    a(n) = my(P=2^prime(n), q=2); while (!isprime(P+q), q = nextprime(q+1)); q; \\ Michel Marcus, Mar 04 2022

Formula

a(n) = A056206(A000040(n)).

A057674 Primes -p+2^n with smallest p prime, arising in A057674.

Original entry on oeis.org

-3, 2, 5, 13, 29, 61, 109, 251, 509, 1021, 2029, 4093, 8179, 16381, 32749, 65519, 131059, 262139, 524269, 1048573, 2097133, 4194301, 8388571, 16777213, 33554371, 67108859, 134217649, 268435367, 536870909, 1073741783, 2147483629, 4294967291, 8589934513, 17179869143
Offset: 0

Views

Author

Labos Elemer, Oct 19 2000

Keywords

Examples

			n=1, 2^1=2. If 2,3,5 are subtracted from 2, then 0,-1 and -3 arise, of which -3 is a prime so a(1)=-3. n=11, 2048-p=q. At first p=29 gives the prime q=2029.
		

Crossrefs

A057676 Smallest prime q such that 2^prime(n) - q is prime.

Original entry on oeis.org

2, 3, 3, 19, 19, 13, 13, 19, 37, 3, 19, 31, 31, 67, 127, 379, 607, 31, 19, 577, 181, 67, 97, 31, 349, 619, 97, 919, 31, 211, 577, 181, 13, 397, 31, 829, 19, 577, 577, 103, 1669, 199, 19, 31, 439, 1021, 601, 1621, 2017, 733, 3, 199, 2113, 619, 1861, 1297, 241, 967
Offset: 1

Views

Author

Labos Elemer, Oct 19 2000

Keywords

Examples

			For n = 4, prime(4) = 11, 2^11 = 2048, p2 = 2048-p1 is satisfied at first with prime p1 = 19 resulting in prime p2 = 2029, so a(4) = 19.
For n = 31, prime(31) = 127, p2 = 2^127-p1 is satisfied first with p1 = 577 and p2 = 170141183460469231731687303715884105151, so a(31) = 577.
		

Crossrefs

Programs

  • Mathematica
    spq[n_]:=Module[{p=2,t=2^Prime[n]},While[!PrimeQ[t-p],p=NextPrime[p]];p]; Array[spq,60] (* Harvey P. Dale, Jul 13 2025 *)
  • PARI
    a(n) = {my(p = 1 << prime(n), q = 2); while(!isprime(p - q), q = nextprime(q + 1)); q;} \\ Amiram Eldar, Feb 18 2025

Extensions

Offset corrected by Amiram Eldar, Feb 18 2025

A127004 Primes p+10^n arising in A127003.

Original entry on oeis.org

3, 13, 103, 1013, 10007, 100003, 1000003, 10000019, 100000007, 1000000007, 10000000019, 100000000003, 1000000000061, 10000000000037, 100000000000031, 1000000000000037, 10000000000000061, 100000000000000003, 1000000000000000003, 10000000000000000097
Offset: 1

Views

Author

Rick L. Shepherd, Jan 01 2007

Keywords

Comments

Equivalently, smallest prime q such that q-10^n is also prime.

Crossrefs

Programs

  • Mathematica
    s={}; Do[p=0; Until[PrimeQ[q=Prime[p]+10^n], p++]; AppendTo[s, q], {n, 0,20}]; s (* James C. McMahon, Dec 30 2024 *)

Extensions

a(18)-a(19) from James C. McMahon, Dec 30 2024

A381041 Smallest prime p such that 3^n + p + 1 is prime.

Original entry on oeis.org

3, 3, 3, 3, 7, 7, 3, 19, 7, 3, 3, 19, 79, 7, 7, 43, 67, 139, 127, 103, 7, 97, 3, 31, 31, 13, 379, 61, 109, 433, 3, 79, 127, 79, 67, 139, 127, 229, 7, 109, 271, 313, 3, 151, 7, 103, 67, 283, 421, 67, 43, 373, 97, 97, 97, 19, 61, 3, 157, 331, 127, 37, 139, 439, 421
Offset: 0

Views

Author

James S. DeArmon, Apr 20 2025

Keywords

Examples

			a(0) = 3, since 3 + (3^0+1) = 5 is prime and 2 + (3^0+1) = 4 is not.
a(1) = 3, since 3 + (3^1+1) = 7 is prime and 2 + (3^1+1) = 6 is not.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local t,p;
     p:= 1: t:= 3^n+1;
     do
       p:= nextprime(p);
       if isprime(p+t) then return p fi
     od;
    end proc:
    map(f, [$0..100]); # Robert Israel, Jun 19 2025
  • Mathematica
    a[n_]:=Module[{p=2},While[!PrimeQ[p+3^n+1], p=NextPrime[p]]; p]; Array[a,65,0] (* Stefano Spezia, Apr 25 2025 *)
  • PARI
    a(n) = my(p=2, x=3^n+1); while (!isprime(p+x), p=nextprime(p+1)); p; \\ Michel Marcus, Apr 24 2025
  • Python
    from sympy import isprime, nextprime
    def a(n):
        p, b = 2, 3**n+1
        while not isprime(p+b):
            p = nextprime(p)
        return p
    print([a(n) for n in range(65)]) # Michael S. Branicky, Apr 23 2025
    
  • Python
    from sympy import nextprime, isprime
    def A381041(n):
        p = 3**n+1
        q = nextprime(p)
        while not isprime(q-p):
            q = nextprime(q)
        return q-p # Chai Wah Wu, May 01 2025
    

Formula

a(n) = A020483(A007051(n)). - Robert Israel, Jun 19 2025

Extensions

More terms from Michael S. Branicky, Apr 23 2025

A071781 Primes p with p-2^e and p+2^e prime for some exponent e.

Original entry on oeis.org

5, 7, 11, 67, 32771
Offset: 1

Views

Author

Rick L. Shepherd, Jun 05 2002

Keywords

Comments

For each n, p-2^e,p,p+2^e is thus an arithmetic progression of primes with difference 2^e. Note that for each n=1,2,3,4,5, only one such e exists and p-2^e=3. There are no other terms up to 20000000.
For all terms, p-2^e must, in fact, be 3 (as one of p-2^e, p and p+2^e is divisible by 3). Each corresponding arithmetic progression of primes has length 3 (p+2^(e+1) is also divisible by 3). Any additional term is too large to include here. Equivalently, this sequence is primes of the form 3+2^e such that 3+2^(e+1) is also prime; i.e., 3+2^A057732(k) is a term iff A057732(k+1) = A057732(k) + 1. Thus much more efficient than the PARI program below is to extend A057732 and examine its terms. - Rick L. Shepherd, Jun 20 2008

Examples

			67 is a term because 67 is prime and there exists e=6 such that both 67-2^6=67-64=3 and 67+2^6=67+64=131 are primes. 32771 is a term because 32771 is prime and there exists e=15 such that both 32771-2^15=32771-32768=3 and 32771+2^15=32771+32768=65539 are primes. Thus 3,67,131 and 3,32771,65539 are two sequences of primes in arithmetic progression with differences 2^6 and 2^15, respectively.
		

Crossrefs

Programs

  • PARI
    for(p=5,20000000,if(isprime(p),e=1; while(p-2^e>1,if(isprime(p-2^e)&&isprime(p+2^e),print1(p,","); break,e++))))

A172183 a(n) is the smallest prime of the form p^q+n, where p and q are prime, or zero if no such prime exists.

Original entry on oeis.org

5, 11, 7, 13, 13, 31, 11, 17, 13, 19, 19, 37, 17, 23, 19, 41, 8209, 43, 23, 29, 29, 31, 31, 73, 29, 53, 31, 37, 37, 79, 0, 41, 37, 43, 43, 61, 41, 47, 43, 67, 73, 67, 47, 53, 53, 71, 79, 73, 53, 59, 59, 61, 61, 79, 59, 83, 61, 67, 67, 109, 0, 71, 67, 73, 73, 191, 71, 193, 73, 79
Offset: 1

Views

Author

Cheng Zhang (cz1(AT)rice.edu), Jan 28 2010, Mar 02 2010

Keywords

Comments

If n mod 6 = 1, both p and q must be 2, and a(n)=0 if n + 4 is not a prime. The values of a(n) for n=257,297,353,383,557 are either greater than 176 000 or 0. Several large entries: a(87) = 2^25633 + 87, a(717) = 2^3217 + 717, a(773) = 2^2539 + 773, a(927) = 2^1117 + 927.

Examples

			a(1)=5 because 5=2^2+1 is the smallest prime of the form p^q+1. a(2)=11 because 11=3^2+2. a(3)=7, because 7=2^2+3. a(17)=8209, because 8209=2^13+17. a(31)=0, because p^q+31 cannot be a prime.
		

Crossrefs

Programs

  • Mathematica
    For[l = {}; n = 1, n <= 70, n++, found = False; If[Mod[n, 2] == 0, For[rm = Infinity; i = 1, i < 100, i++, For[j = 1, j < 100, j++, p = Prime[i]; q = Prime[j]; r = p^q + n; If[r >= rm, Break[], If[PrimeQ[r], rm = r; found = True]]; ]; ], (* if n is odd, r=2^q+n *) If[Mod[n, 6] == 1, r = 4 + n; If[PrimeQ[r], found = True], For[j = 1, j < 1000, j++, q = Prime[j]; r = 2^q + n; If[PrimeQ[r], found = True; rm = r; Break[]]; ]; ]; ]; If[ ! found, rm = 0]; l = Append[l, rm]; ]; l
Showing 1-10 of 10 results.