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.
%I A127356 #23 Nov 12 2022 02:10:21 %S A127356 1,2,6,2,6,2,6,2,6,12,4,2,24,2,6,6,18,6,2,6,4,2,12,12,2,6,2,12,2,6,2, %T A127356 6,6,10,12,4,4,2,12,12,18,4,6,2,6,8,4,2,6,2,6,12,4,24,6,18,18,6,2,6,8, %U A127356 18,2,6,2,6,4,4,6,2,6,12,4,4,2,6,30,2,24,10 %N A127356 a(n) is the smallest k > 0 such that k^2 + prime(n) is prime. %C A127356 All terms apart from the first need to be even because all primes but the first one have the same parity. Record values 1, 2, 6, 12, 24, 30, 42, 54, 60, 66, 90, 132, 138, 210, 270, ... are set at n=1, 2, 3, 10, 13, 77, 92, 152, 294, 484, 517, 964, 1203, 2876, 14118, ... - _R. J. Mathar_, Apr 02 2007 %C A127356 a(n) exists for all n on the Hardy-Littlewood conjecture F. - _Charles R Greathouse IV_, Jul 26 2012 %H A127356 Zak Seidov, <a href="/A127356/b127356.txt">Table of n, a(n) for n = 1..1000</a> %e A127356 17 = prime(7); 17 + 1^2 = 18, 17 + 2^2 = 21, 17 + 3^2 = 26, 17 + 4^2 = 33, 17 + 5^2 = 42 are all composite, but 17 + 6^2 = 53 is prime. Hence a(7) = 6. %p A127356 a:=proc(n) local A,j: A:={}: for j from 1 to 50 do if isprime(ithprime(n)+j^2)=true then A:=A union {j} else A:=A fi od: A[1]: end: seq(a(n),n=1..120); # _Emeric Deutsch_, Apr 01 2007 %p A127356 A127356 := proc(n) local p,a; p := ithprime(n) ; a := 1 ; while not isprime(p+a^2) do a := a+1 ; od ; RETURN(a) ; end: for n from 1 to 120 do printf("%d,",A127356(n)) ; od ; # _R. J. Mathar_, Apr 02 2007 %t A127356 Join[{1},Table[p=Prime[n];x=2;While[!PrimeQ[a=p+x^2],x=x+2]; x,{n,2,100}]] (* _Zak Seidov_, Oct 12 2012 *) %t A127356 sk[n_]:=Module[{k=2},While[!PrimeQ[n+k^2],k=k+2];k]; Join[{1},Table[sk[n],{n,Prime[Range[2,80]]}]] (* _Harvey P. Dale_, Jul 26 2017 *) %o A127356 (PARI) {for(n=1, 93, p=prime(n); k=1; while(!isprime(p+k^2), k++); print1(k, ","))} /* _Klaus Brockhaus_, Apr 05 2007 */ %o A127356 (Python) %o A127356 from sympy import isprime, nextprime, prime %o A127356 def a(n): %o A127356 if n == 1: return 1 %o A127356 k, pn = 2, prime(n) %o A127356 while not isprime(pn + k*k): k += 2 %o A127356 return k %o A127356 print([a(n) for n in range(1, 81)]) # _Michael S. Branicky_, Nov 11 2022 %Y A127356 Cf. A000040 (the primes), A000290 (the squares). %K A127356 nonn %O A127356 1,2 %A A127356 _J. M. Bergot_, Mar 30 2007 %E A127356 Edited, corrected and extended by _Emeric Deutsch_, _R. J. Mathar_ and _Klaus Brockhaus_, Apr 01 2007