OFFSET
1,1
LINKS
Daniel Starodubtsev, Table of n, a(n) for n = 1..1000
EXAMPLE
3*3*2^1 - 1 = 17, 17 and 19 are twin primes so a(1)=3.
5*3*2^2 - 1 = 59, 59 and 61 are twin primes so a(2)=5.
3*3*2^3 - 1 = 71, 71 and 73 are twin primes so a(3)=3.
5*3*2^4 - 1 = 119, 119 and 121 are twin primes so a(4)=5.
MATHEMATICA
Array[Block[{p = 3}, While[! AllTrue[3 p*2^# + {-1, 1}, PrimeQ], p = NextPrime@ p]; p] &, 54] (* Michael De Vlieger, Nov 21 2019 *)
PROG
(PFGW Script)
SCRIPT
DIM i
DIM j
DIM n, 0
OPENFILEOUT myf, a(n).txt
LABEL loop1
SET n, n+1
IF n>500 THEN END
SET i, 1
LABEL loop2
SET i, i+1
SET j, p(i)
PRP j*3*2^n-1, n
IF ISPRP THEN GOTO a
GOTO loop2
LABEL a
PRP j*3*2^n+1, n
IF ISPRP THEN GOTO b
GOTO loop2
LABEL b
WRITE myf, j
GOTO loop1
(PARI) for(n=1, 54, my(m=3*2^n); forprime(k=3, oo, my(j=k*m); if(ispseudoprime(j-1)&&ispseudoprime(j+1), print1(k, ", "); break))) \\ Hugo Pfoertner, Nov 21 2019
(PARI) a(n) = my(p=3, q); while (!isprime(q=p*3*2^n - 1) || !isprime(q+2), p = nextprime(p+1)); p; \\ Michel Marcus, May 06 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierre CAMI, Nov 20 2019
STATUS
approved