login
A106821
Greatest k < n such that 2^n - 2^k -1 is prime or 0 if no such prime exists.
5
0, 0, 2, 3, 3, 5, 0, 7, 7, 5, 3, 9, 11, 13, 0, 11, 11, 17, 11, 19, 17, 16, 0, 21, 13, 9, 0, 23, 17, 18, 0, 31, 23, 28, 31, 34, 0, 33, 0, 38, 31, 37, 0, 30, 43, 17, 31, 45, 41, 37, 7, 47, 41, 44, 0, 42, 55, 0, 27, 42, 43, 61, 0, 29
OFFSET
1,3
EXAMPLE
2^3 - 2^2 -1 = 3 prime so a(3)=2
2^4 - 2^3 -1 = 7 prime so a(4)=3
2^5 - 2^3 -1 = 23 prime so a(5)=3
2^6 - 2^5 -1 = 31 prime so a(6)=5
MATHEMATICA
kk[n_]:=Module[{k=n-1, n2=2^n}, While[!PrimeQ[n2-2^k-1]&&k>0, k--]; k]; Array[kk, 70] (* Harvey P. Dale, Mar 09 2012 *)
PROG
(PARI)
for(n=1, 1000, q=1;
forstep(k=n-1, 0, -1,
if(isprime(2^n-2^k-1),
q=0;
print1(k, ", ");
break()
)
);
if(q, print1(0, ", "))
) /* Joerg Arndt, Jan 14 2011 */
CROSSREFS
Sequence in context: A118963 A127641 A328730 * A065863 A341931 A341701
KEYWORD
nonn
AUTHOR
Pierre CAMI, May 18 2005
EXTENSIONS
Extra numbers to right of data removed from b-file by Andrew Howroyd, Feb 23 2018
STATUS
approved