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.

A094709 Smallest k such that prime(n)# - k and prime(n)# + k are primes, where prime(n)# = A002110(n).

Original entry on oeis.org

0, 1, 1, 13, 1, 17, 59, 23, 79, 101, 83, 239, 71, 149, 367, 73, 911, 313, 373, 523, 313, 331, 197, 101, 1493, 523, 293, 577, 2699, 1481, 1453, 5647, 647, 419, 757, 4253, 509, 239, 10499, 191, 4013, 2659, 617, 6733, 1297, 971
Offset: 1

Views

Author

Reinhard Zumkeller, May 21 2004

Keywords

Comments

a(n) = A002110(n) - A094710(n) = A094711(n) - A002110(n),
Goldbach's conjecture implies that a(n) is defined for all n. - David Wasserman, May 31 2007

Examples

			a(4)=13 because prime(4)=7, 7# = 2*3*5*7 = 210, and 210 - 13 and 210 + 13 are primes.
		

Crossrefs

Programs

  • Mathematica
    pc[n_]:=Module[{x=0,i=0},Do[If[PrimeQ[n-i]&&PrimeQ[n+i],x=i;Break[]],{i,9!}];x]; r=2;lst={};Do[p=Prime[n];r*=p;AppendTo[lst,pc[r]],{n,2,2*4!}];lst (* Vladimir Joseph Stephan Orlovsky, Jun 14 2009 *)
    sk[n_]:=Module[{k=0},While[!PrimeQ[n+k]||!PrimeQ[n-k],k++];k]; sk/@ FoldList[ Times,Prime[Range[50]]] (* Harvey P. Dale, Apr 03 2022 *)
  • Python
    from sympy import isprime, prime, primerange
    def aupton(terms):
      phash, alst = 2, [0]
      for p in primerange(3, prime(terms)+1):
        phash *= p
        for k in range(1, phash//2):
          if isprime(phash-k) and isprime(phash+k): alst.append(k); break
      return alst
    print(aupton(46)) # Michael S. Branicky, May 29 2021

Extensions

More terms from Don Reble, May 27 2004

A094710 Smaller of a pair (p,q) of primes with (p+q)/2=prime(n)# and q-p is minimal.

Original entry on oeis.org

5, 29, 197, 2309, 30013, 510451, 9699667, 223092791, 6469693129, 200560490047, 7420738134571, 304250263527139, 13082761331669881, 614889782588491043, 32589158477190044657, 1922760350154212638159, 117288381359406970982957, 7858321551080267055878717, 557940830126698960967414867
Offset: 2

Views

Author

Reinhard Zumkeller, May 21 2004

Keywords

Comments

a(n) = Max{p prime: (p+q)/2=prime(n)# for another prime q>p};
a(n) = A002110(n) - A094709(n); (a(n) + A094711(n))/2 = A002110(n).

Crossrefs

Programs

  • Python
    from sympy import isprime, prime, primerange
    def aupton(terms):
      phash, alst = 2, []
      for p in primerange(3, prime(terms)+1):
        phash *= p
        for k in range(1, phash//2):
          if isprime(phash-k) and isprime(phash+k): alst.append(phash-k); break
      return alst
    print(aupton(20)) # Michael S. Branicky, May 29 2021

Extensions

Corrected by T. D. Noe, Nov 15 2006
a(12)-a(20) from Donovan Johnson, Apr 27 2008
Showing 1-2 of 2 results.