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.

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

This page as a plain text file.
%I A094709 #22 Apr 03 2022 11:42:23
%S A094709 0,1,1,13,1,17,59,23,79,101,83,239,71,149,367,73,911,313,373,523,313,
%T A094709 331,197,101,1493,523,293,577,2699,1481,1453,5647,647,419,757,4253,
%U A094709 509,239,10499,191,4013,2659,617,6733,1297,971
%N A094709 Smallest k such that prime(n)# - k and prime(n)# + k are primes, where prime(n)# = A002110(n).
%C A094709 a(n) = A002110(n) - A094710(n) = A094711(n) - A002110(n),
%C A094709 Goldbach's conjecture implies that a(n) is defined for all n. - _David Wasserman_, May 31 2007
%H A094709 David Wasserman, <a href="/A094709/b094709.txt">Table of n, a(n) for n = 1..250</a>
%e A094709 a(4)=13 because prime(4)=7, 7# = 2*3*5*7 = 210, and 210 - 13 and 210 + 13 are primes.
%t A094709 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 *)
%t A094709 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 *)
%o A094709 (Python)
%o A094709 from sympy import isprime, prime, primerange
%o A094709 def aupton(terms):
%o A094709   phash, alst = 2, [0]
%o A094709   for p in primerange(3, prime(terms)+1):
%o A094709     phash *= p
%o A094709     for k in range(1, phash//2):
%o A094709       if isprime(phash-k) and isprime(phash+k): alst.append(k); break
%o A094709   return alst
%o A094709 print(aupton(46)) # _Michael S. Branicky_, May 29 2021
%Y A094709 Cf. A078611, A002110, A094710, A094711.
%K A094709 nonn
%O A094709 1,4
%A A094709 _Reinhard Zumkeller_, May 21 2004
%E A094709 More terms from _Don Reble_, May 27 2004