A284631 a(n) = smallest odd k such that either k*2^n - 1 or k*2^n + 1 is prime.
1, 1, 1, 1, 1, 3, 1, 1, 7, 5, 3, 3, 1, 5, 5, 1, 1, 3, 1, 7, 7, 25, 13, 39, 5, 7, 15, 13, 7, 3, 1, 5, 9, 3, 25, 3, 15, 3, 5, 27, 3, 9, 3, 15, 7, 19, 27, 5, 19, 7, 17, 7, 51, 5, 3, 27, 29, 77, 27, 17, 1, 53, 9, 3, 9, 3, 9, 31, 23, 27, 39, 5, 15, 21, 5, 3, 29
Offset: 1
Keywords
Examples
1*2^1 + 1 = 3 (prime), so a(1) = 1; 1*2^2 - 1 = 3 (prime), so a(2) = 1; 1*2^3 - 1 = 7 (prime), so a(3) = 1.
Links
- Pierre CAMI, Table of n, a(n) for n = 1..10000
- Pierre CAMI, PFGW Script
Programs
-
Mathematica
Table[k = 1; While[Nor @@ Map[PrimeQ, k*2^n + {-1, 1}], k += 2]; k, {n, 77}] (* Michael De Vlieger, Apr 02 2017 *)
-
PARI
a(n) = my(k=1); while (!isprime(k*2^n-1) && !isprime(k*2^n+1), k+=2); k; \\ Michel Marcus, Mar 31 2017
Extensions
Missing a(9153)-a(9163) in b-file inserted by Andrew Howroyd, Feb 27 2018
Comments