(Translated by https://www.hiragana.jp/)
A179013 - OEIS
login
A179013
Greatest k <= n such that 2^n-2^k+1 is prime, or 0 if no such prime exists.
4
0, 1, 2, 2, 4, 2, 5, 6, 8, 8, 5, 2, 9, 12, 9, 12, 16, 0, 12, 18, 0, 2, 20, 18, 18, 16, 21, 16, 26, 18, 27, 30, 20, 22, 19, 20, 25, 36, 23, 32, 37, 38, 41, 38, 9, 38, 25, 44, 41, 44, 17, 48, 50, 38, 52, 32, 38, 34, 48, 18, 54
OFFSET
1,3
COMMENTS
For the first 8300 terms, there are 291 values of n such that a(n)=0 and 6927 values of n with a(n) >= n/2.
MATHEMATICA
Table[k=n; While[k>0 && ! PrimeQ[2^n-2^k+1], k--]; k, {n, 100}]
PROG
(Sage)
A179013 = lambda n: next((k for k in reversed([1..floor(log(2**n+1, 2))]) if is_pseudoprime(2**n-2**k+1)), 0) # D. S. McNeil, Jan 12 2011
(PARI) a(n) = {my(k=n); while (!isprime(2^n-2^k+1), k--; if (k==0, return (0))); k; } \\ Michel Marcus, Sep 21 2019
CROSSREFS
Sequence in context: A133181 A286280 A290088 * A090397 A339176 A328729
KEYWORD
nonn
AUTHOR
Pierre CAMI, Jan 12 2011
STATUS
approved