Your task is to take a positive number as input, n, and output the length of the longest rep-digit representation of n in any base. For example 7 can be represented as any of the following
111_2
21_3
13_4
12_5
11_6
10_7
7_8
The rep-digits are 111_2
and 11_6
, 111_2
is longer so our answer is 3.
This is a code-golf question so answers will be scored in bytes, with fewer bytes being better.
Test Cases
1 -> 1
2 -> 1
3 -> 2
4 -> 2
5 -> 2
6 -> 2
7 -> 3
8 -> 2
9 -> 2
10 -> 2
11 -> 2
26 -> 3
63 -> 6
1023-> 10
Sample implementation
Here is an implementation in Haskell that can be used to generate more test cases.
f 0 y=[]
f x y=f(div x y)y++[mod x y]
s x=all(==x!!0)x
g x=maximum$map(length.f x)$filter(s.f x)[2..x+1]
base > 1
? \$\endgroup\$222
in base 3. \$\endgroup\$