OFFSET
1,2
EXAMPLE
MATHEMATICA
sk[n_]:=Module[{k=2}, While[!PrimeQ[n+k^2], k=k+2]; k]; DeleteDuplicates[ Join[ {1}, Table[sk[n], {n, Prime[Range[2, 1000000]]}]], GreaterEqual] (* The program generates the first 22 terms of the sequence. *) (* Harvey P. Dale, Nov 07 2022 *)
PROG
(Python)
from itertools import count, islice
from sympy import isprime, nextprime, prime
def agen():
pn = 2; record = 1; yield record
for n in count(2):
k, pn = 2, nextprime(pn)
while not isprime(pn + k*k): k += 2
if k > record: record = k; yield record
print(list(islice(agen(), 20))) # Michael S. Branicky, Nov 11 2022
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Klaus Brockhaus, Apr 09 2007
EXTENSIONS
a(27)-a(33) from Donovan Johnson, Dec 09 2008
a(34)-a(35) from Michael S. Branicky, Nov 11 2022
STATUS
approved