A181490 Numbers k such that 3*2^k-1 and 3*2^k+1 are twin primes (A001097).
1, 2, 6, 18
Offset: 1
Programs
-
GAP
Filtered([1..300],k->IsPrime(3*2^k-1) and IsPrime(3*2^k+1)); # Muniru A Asiru, Mar 11 2018
-
Maple
a:=k->`if`(isprime(3*2^k-1) and isprime(3*2^k+1),k,NULL); seq(a(k),k=1..1000); # Muniru A Asiru, Mar 11 2018
-
Mathematica
fQ[n_] := PrimeQ[3*2^n - 1] && PrimeQ[3*2^n + 1]; k = 1; lst= {}; While[k < 15001, If[fQ@k, AppendTo[lst, k]; Print@k]; k++ ] (* Robert G. Wilson v, Nov 05 2010 *) Select[Range[20],AllTrue[3*2^#+{1,-1},PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Sep 24 2014 *)
-
PARI
for( k=1,999, ispseudoprime(3<
Extensions
Pari program repaired by Charles R Greathouse IV, Mar 14 2011
Comments