OFFSET
0,3
COMMENTS
Equivalently, a(n) is the least positive k such that n is a repdigit number in base 2^k.
See A302291 for the variant where leading zeros are not allowed.
LINKS
FORMULA
EXAMPLE
The first terms, alongside the binary expansion of n with periodic part in parentheses, are:
n a(n) bin(n)
-- ---- ------
0 1 (0)
1 1 (1)
2 2 (10)
3 1 (1)(1)
4 3 (100)
5 2 (01)(01)
6 3 (110)
7 1 (1)(1)(1)
8 4 (1000)
9 3 (001)(001)
10 2 (10)(10)
11 4 (1011)
12 4 (1100)
13 4 (1101)
14 4 (1110)
15 1 (1)(1)(1)(1)
16 5 (10000)
17 4 (0001)(0001)
18 3 (10)(10)
19 5 (10011)
20 5 (10100)
PROG
(PARI) a(n) = for (k=1, oo, if (#Set(digits(n, 2^k))<=1, return (k)))
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Apr 04 2018
STATUS
approved