Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #26 Jan 31 2022 06:46:20
%S 2,3,29,569,6701,64919,1720289,256828391,33090566651,248804328761,
%T 55130906480861,119321483551349
%N a(n) is the first prime p such that the next n primes are p+2*k^2 for k=1..n.
%C If p = prime(m) is a prime such that the next n primes are p+2*k^2 for k=1..n, then A212769(m+k-1) = 2*p+1 for k=1..n.
%C a(12) > 10^15. - _Martin Ehrenstein_, Jan 31 2022
%e a(3) = 569 because the next 3 primes after 569 are 571 = 569 + 2*1^2, 577 = 569 + 2*2^2, 587 = 569 + 2*3^2, and 569 is the first prime that works.
%p P:= select(isprime, [2,seq(i,i=3..2*10^6,2)]):
%p f:= proc(n) local k;
%p for k from 1 do
%p if P[n+k] <> P[n]+2*k^2 then return k-1 fi
%p od
%p end proc:
%p V:= Array(0..6):
%p for n from 1 to nops(P)-21 do
%p v:= H(n);
%p if V[v] = 0 then V[v]:= P[n] fi;
%p od:
%p convert(V,list);
%o (Python)
%o from sympy import prime, nextprime
%o def A350868(n):
%o if n < 2:
%o return 2+n
%o qlist = [prime(i)-2 for i in range(2,n+2)]
%o p = prime(n+1)
%o mlist = [2*k**2 for k in range(1,n+1)]
%o while True:
%o if qlist == mlist:
%o return p-mlist[-1]
%o qlist = [q-qlist[0] for q in qlist[1:]]
%o r = nextprime(p)
%o qlist.append(r-p+qlist[-1])
%o p = r # _Chai Wah Wu_, Jan 24 2022
%Y Cf. A212769.
%K nonn,more
%O 0,1
%A _J. M. Bergot_ and _Robert Israel_, Jan 20 2022
%E a(7) from _David A. Corneth_, Jan 20 2022
%E a(8) from _Chai Wah Wu_, Jan 25 2022
%E a(9) from _Martin Ehrenstein_, Jan 26 2022
%E a(10)-a(11) from _Martin Ehrenstein_, Jan 31 2022