login

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”).

Least k>=1 such that n^2+kn-1 and n^2+kn+1 are twin primes.
3

%I #10 Nov 25 2013 14:09:11

%S 3,1,1,11,1,1,53,1,3,5,7,3,11,16,1,11,43,6,11,1,1,8,13,1,17,7,3,11,43,

%T 4,11,4,7,8,31,9,17,1,9,35,1,4,53,4,7,41,43,6,23,1,17,8,67,1,5,4,17,

%U 11,1,7,197,4,3,11,25,1,227,7,3,14,157,19,11,16,3,71,43,6,53,7,7,44,31,3,41

%N Least k>=1 such that n^2+kn-1 and n^2+kn+1 are twin primes.

%H R. J. Mathar, <a href="/A082466/b082466.txt">Table of n, a(n) for n = 1..1000</a>

%p A082466 := proc(n)

%p local k,p ;

%p for k from 1 do

%p p := (n+k)*n-1 ;

%p if isprime(p) and isprime(p+2) then

%p return k;

%p end if;

%p end do:

%p end proc: # _R. J. Mathar_, Jul 20 2012

%t lk[n_]:=Module[{k=1},While[!And@@PrimeQ[n^2+k*n+{1,-1}],k++];k]; Array[ lk,90] (* _Harvey P. Dale_, Nov 25 2013 *)

%o (PARI) a(n)=if(n<0,0,k=1; while(isprime(n^2+k*n+1)*isprime(n^2+k*n-1)==0,s++); k)

%K nonn

%O 1,1

%A _Benoit Cloitre_, Apr 27 2003