login
a(n) = least k with -3<k<2*n such that n*(n+1)+k and n*(n+1)+k+2 are twin primes, or 0 if no such k exists.
2

%I #18 Apr 02 2024 03:01:09

%S 1,-1,-1,0,-1,-1,3,-1,11,0,5,23,9,17,-1,9,5,5,0,-1,-1,15,17,-1,9,0,53,

%T 9,11,0,27,5,29,39,17,0,21,-1,47,27,-1,65,39,17,11,75,11,29,0,-1,5,33,

%U 0,-1,39,59,23,39,-1,11,39,11,17,57,47,-1,81,29,101,39,119,23,15,89,41

%N a(n) = least k with -3<k<2*n such that n*(n+1)+k and n*(n+1)+k+2 are twin primes, or 0 if no such k exists.

%C Only 11 values are zero for n < 434. Conjecture: no more 0 values if n>433.

%H Pierre CAMI, <a href="/A200652/b200652.txt">Table of n, a(n) for n = 1..10000</a>

%p A200652 := proc(n)

%p for k from -2 to 2*n-1 do

%p if isprime(n*(n+1)+k) and isprime(n*(n+1)+k+2) then

%p return k;

%p end if;

%p end do:

%p return 0 ;

%p end proc:

%p seq(A200652(n),n=1..80) ; # _R. J. Mathar_, Nov 22 2011

%t a[n_]:=Module[{k=0},For[m=-2, m<2n&&k==0, m++, If[PrimeQ[n(n+1)+m]&&PrimeQ[n(n+1)+m+2], k=m]]; k]; Array[a,75] (* _Stefano Spezia_, Apr 01 2024 *)

%Y Cf. A200653.

%K sign

%O 1,7

%A _Pierre CAMI_, Nov 20 2011