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

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

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
Showing 1-2 of 2 results.