OFFSET
0,5
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..65537
FORMULA
a(n) = 1 + a(log_2(n)) if n is a power of 2 except 1, 0 otherwise.
PROG
(PARI) nbi(n) = {my(nb = 0); if ((ispower(n, , &m) && (m==2)) || (n==2), return(nbi(valuation(n, 2))+1); ); nb; }
a(n) = { my(nb = 0); if ((ispower(n, , &m) && (m==2)) || (n==2), return(nbi(valuation(n, 2))+1); ); nb; } \\ Michel Marcus, Mar 11 2015; corrected Jun 13 2022
(PARI) A255309(n) = { my(k=0); while((n>1)&&!bitand(n, n-1), n = valuation(n, 2); k++); (k); }; \\ Antti Karttunen, Sep 30 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Paul Boddington, Feb 20 2015
EXTENSIONS
Extended up to a(128) by Antti Karttunen, Sep 30 2018
STATUS
approved