%I #23 Sep 17 2019 10:31:45
%S 3,2,1,3,2,2,2,20,22,2,12,10,28,32,8,7,20,15,15,12,5,3,68,15,33,12,10,
%T 3,23,28,130,8,13,32,38,7,57,3,25,3,8,18,77,12,65,22,18,18,2,10,18,30,
%U 110,10,10,28,15,22,37,7,2,10,7,8,48,3,3,87,103,128,30
%N Least k such that 6*k*prime(n)^2 - 1 and 6*k*prime(n)^2 + 1 are twin primes.
%C Define Sp sum of log(6*prime(n))^2 from n=1 to N. Define Sk sum of k from n=1 to N. As N increases Sk/Sp tends to 0.6.
%H Pierre CAMI, <a href="/A112746/b112746.txt">Table of n, a(n) for n = 1..10000</a>
%e 6*1*prime(1)^2-1=23 prime but 25 composite.
%e 6*2*prime(1)^2-1=47 prime but 49 composite.
%e 6*3*prime(1)^2-1=71 prime as 73 so a(1)=3.
%t Table[k = 1; While[c = 6*k*Prime[n]^2; ! PrimeQ[c - 1] || ! PrimeQ[c + 1], k++ ]; k, {n, 80}] (* _Ray Chandler_, Oct 08 2005 *)
%o (PFGW64 from Primeform group and SCRIPTIFY)
%o Command pfgw64 -f in.txt
%o in.txt file :
%o SCRIPT
%o DIM nn,0
%o DIM kk
%o DIMS tt
%o OPENFILEOUT myfile,twin.txt
%o LABEL loopn
%o SET nn,nn+1
%o IF nn>10000 THEN END
%o SET kk,0
%o LABEL loopk
%o SET kk,kk+1
%o SETS tt,%d,%d\,;p(nn);kk
%o PRP 6*kk*p(nn)^2-1,tt
%o IF ISPRP THEN GOTO a
%o IF ISPRIME THEN GOTO a
%o GOTO loopk
%o LABEL a
%o PRP 6*kk*p(nn)^2+1,tt
%o IF ISPRP THEN GOTO b
%o IF ISPRIME THEN GOTO b
%o GOTO loopk
%o LABEL b
%o WRITE myfile,tt
%o GOTO loopn
%Y Cf. A112744, A112745.
%K nonn
%O 1,1
%A _Pierre CAMI_, Sep 18 2005
%E Extended by _Ray Chandler_, Oct 08 2005
%E Corrected, extended and b file by _Pierre CAMI_, Feb 27 2012