login
Least k such that k*6^n-1 , k*6^n+1, and 2*k*6^n-1 are prime; that is, twin primes and a Sophie Germain prime.
1

%I #19 Jul 29 2015 11:18:18

%S 1,5,2,282,47,315,1530,255,287,1577,4902,817,1600,700,1540,422,9070,

%T 3190,6860,6627,5115,12462,2077,10010,20515,13487,6787,2235,23167,

%U 17022,2837,15155,11352,1892,16662,2777,22640,4730,72905,63665,25377,6477,26537

%N Least k such that k*6^n-1 , k*6^n+1, and 2*k*6^n-1 are prime; that is, twin primes and a Sophie Germain prime.

%H Pierre CAMI, <a href="/A212481/b212481.txt">Table of n, a(n) for n = 1..200</a>

%e 1*6^1-1=5 prime

%e 1*6^1+1=7 prime

%e 2*6^1-1=11 prime so a(1)=1

%t Table[k = 1; While[! (PrimeQ[k*6^n - 1] && PrimeQ[k*6^n + 1] && PrimeQ[2*k*6^n - 1]), k++]; k, {n, 50}] (* _T. D. Noe_, Jun 06 2012 *)

%t lk[n_]:=Module[{k=1,c=6^n},While[!AllTrue[{k*c-1,k*c+1,2k*c-1},PrimeQ], k++];k]; Array[lk,50] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Jul 29 2015 *)

%o PFGW64 and SCRIPTIFY from Primeform Group

%o Command : pfgw64 -f in.txt

%o in.txt file :

%o SCRIPT

%o DIM nn,0

%o DIM kk,0

%o DIMS tt

%o OPENFILEOUT myfile,a(n).txt

%o LABEL loopn

%o SET nn,nn+1

%o IF nn>200 THEN END

%o SET kk,0

%o LABEL loopk

%o SET kk,kk+1

%o SETS tt,%d,%d\,;nn;kk

%o PRP kk*6^nn-1,tt

%o IF ISPRP THEN GOTO a

%o IF ISPRIME THEN GOTO a

%o GOTO loopk

%o LABEL a

%o PRP kk*6^nn+1,tt

%o IF ISPRP THEN GOTO b

%o IF ISPRIME THEN GOTO b

%o GOTO loopk

%o LABEL b

%o PRP 2*kk*6^nn-1,tt

%o IF ISPRP THEN GOTO c

%o IF ISPRIME THEN GOTO c

%o GOTO loopk

%o LABEL c

%o WRITE myfile,tt

%o GOTO loopn

%K nonn

%O 1,2

%A _Pierre CAMI_, Jun 02 2012