%I #8 May 26 2023 16:17:28
%S 3,7,8,15,39,7,8,8,335,32,55,24,704,39,1631,87,15,15,16,9235919,119,
%T 4959,5247,56,39,80,40,746511,104,488880,33695,92901159,23,23,24,24,
%U 175,244184,23855,552,1391,6215,157440,55,168,56,319,43455,44295,847
%N Least k such that prime(n)*(k^2) + prime(n)*k + 1 = m^2 = a square.
%C When a(n+1)=a(n) then p(n),p(n+1) are twin primes.
%t 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 *)
%o (PARI) forprime(p=2,400,for(k=1,10^9,if(issquare(p*k*k+p*k+1),print1(k);print1(",");break)))
%K nonn
%O 1,1
%A _Pierre CAMI_, Apr 15 2005
%E Edited by _Ralf Stephan_, Apr 06 2009