OFFSET
1,1
COMMENTS
When a(n+1)=a(n) then p(n),p(n+1) are twin primes.
MATHEMATICA
lk[n_]:=Module[{k=1, p=Prime[n]}, While[!IntegerQ[Sqrt[p*k^2+p*k+1]], k++]; k]; Array[lk, 15] (* The program generates the first 15 terms of the sequence. To generate more, increase the Array constant but the program may take a long time to run. *) (* Harvey P. Dale, May 26 2023 *)
PROG
(PARI) forprime(p=2, 400, for(k=1, 10^9, if(issquare(p*k*k+p*k+1), print1(k); print1(", "); break)))
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierre CAMI, Apr 15 2005
EXTENSIONS
Edited by Ralf Stephan, Apr 06 2009
STATUS
approved