A174269 Numbers k such that exactly one of 2^k - 1 and 2^k + 1 is a prime.
0, 1, 3, 4, 5, 7, 8, 13, 16, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203, 2281, 3217, 4253, 4423, 9689, 9941, 11213, 19937, 21701, 23209, 44497, 86243, 110503, 132049, 216091, 756839, 859433, 1257787, 1398269, 2976221, 3021377, 6972593, 13466917
Offset: 1
Keywords
Examples
0 is in the sequence because 2^0 - 1 = 0 is nonprime and 2^0 + 1 = 2 is prime; 2 is not in the sequence because 2^2 - 1 = 3 and 2^2 + 1 = 5 are both prime.
Links
- Jeppe Stig Nielsen, Table of n, a(n) for n = 1..52
Programs
-
Mathematica
Select[Range[0, 5000], Xor[PrimeQ[2^# - 1], PrimeQ[2^# + 1]] &] (* Michael De Vlieger, Jan 03 2016 *)
-
PARI
isok(k) = my(p = 2^k-1, q = p+2); bitxor(isprime(p), isprime(q)); \\ Michel Marcus, Jan 03 2016
Formula
a(n) = A285929(n) for n > 2. - Jeppe Stig Nielsen, Feb 19 2023
Extensions
a(10)-a(43) from Charles R Greathouse IV, Mar 20 2010
Comments