A238904 Smallest k such that 2^k + (2n+1) and (2n+1)*2^k + 1 are both prime, k <= n, or -1 if no such k exists.
0, 1, 1, 2, 1, 1, 2, 1, -1, 6, 1, -1, 2, 2, 1, -1, 6, 1, 2, 1, 1, 2, 9, -1, 2, 1, -1, 4, 2, -1, 12, 4, 1, 2, 1, 3, 6, 3, -1, 2, 1, -1, 4, 6, 9, 8, 2, 1, 2, 1, 3, -1, 1, -1, 6, 1, -1, 12, 6, 3, 12, 8, 1, 2, 3, 3, 4, 1, -1, -1, 3, -1, -1, 60, 3, 4, 2, 1, 12
Offset: 0
Keywords
Examples
a(0) = 0 because 2^0 + (2*0+1) = 2 and (2*0+1)*2^0 + 1 = 2 are both prime.
Links
- Giovanni Resta, Table of n, a(n) for n = 0..1000
Programs
-
Mathematica
a[n_] := Catch@Block[{k=0}, While[k <= n, If[PrimeQ[2^k + 2*n + 1] && PrimeQ[(2*n + 1)*2^k + 1], Throw@k]; k++]; -1]; a/@ Range[0,80] (* Giovanni Resta, Mar 15 2014 *)