login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A098388
a(n) = floor(log_2(prime(n))).
7
1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9
OFFSET
1,3
COMMENTS
a(n) is the greatest k such that 2^k does not exceed prime(n). - David James Sycamore, Sep 14 2021
FORMULA
a(n) = A000523(A000040(n)); A098391(n) = A000523(a(n)).
a(n) = A035100(n) - 1. - Michel Marcus, Sep 17 2017
MAPLE
map(ilog2, select(isprime, [2, seq(2*i+1, i=1..1000)])); # Robert Israel, Jun 08 2015
MATHEMATICA
Floor[Log[2, Prime[Range[105]]]] (* data *) (* parameter changed by Hartmut F. W. Hoft, Jun 02 2015 *)
PROG
(PARI) a(n) = logint(prime(n), 2); \\ Michel Marcus, Sep 17 2017
(Python)
from sympy import prime
def A098388(n): return prime(n).bit_length()-1 # Chai Wah Wu, Nov 19 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Reinhard Zumkeller, Sep 06 2004
STATUS
approved