OFFSET
0,4
COMMENTS
Leading zeros in binary expansions are ignored.
The least possible k is:
- 0 for n = 0,
- 1 for n = 2^m-1 for some m > 0,
- 2 for n = 2*m for some m > 0,
- 5 otherwise.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..8192
Rémy Sigrist, PARI program for A337225
FORMULA
a(2^k-1) = k for any k > 0.
EXAMPLE
The first terms, alongside the binary expansions of n and of the corresponding k's, are:
n a(n) bin(n) {bin(k)}
-- ---- ------ -------------------
0 1 0 {0}
1 1 1 {1}
2 1 10 {10}
3 2 11 {1, 11}
4 2 100 {10, 100}
5 1 101 {101}
6 2 110 {10, 110}
7 3 111 {1, 11, 111}
8 3 1000 {10, 100, 1000}
9 2 1001 {101, 1001}
10 2 1010 {10, 1010}
11 2 1011 {101, 1011}
12 4 1100 {10, 100, 110, 1100}
13 2 1101 {101, 1101}
14 3 1110 {10, 110, 1110}
15 4 1111 {1, 11, 111, 1111}
16 4 10000 {10, 100, 1000, 10000}
PROG
(PARI) See Links section.
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Aug 19 2020
STATUS
approved