OFFSET
0,4
COMMENTS
This sequence diverges to infinity by Van der Waerden's theorem.
FORMULA
a(2^k) = k for any k > 0.
a(2^k - 1) = k for any k >= 0.
a(2*n) >= a(n).
PROG
(PARI) a(n, base = 2) = { my (b = digits(n, base), v = if (n, 1, 0)); for (i = 1, #b-1, for (j = i+1, #b, if (b[i]==b[j], my (d = j-i, k = j); while (k + d <= #b && b[k + d]==b[i], k += d; ); v = max(v, 1 + (k-i) / d); ); ); ); return (v); }
(Python)
def A368857(n):
if n == 0: return 0
l = len(s:=bin(n)[2:])
return 1+max((k-1-i)//j for i in range(l) for j in range(1, l-i+3>>1) for k in range(i+1, l+1, j) if len(set(s[i:k:j]))==1) # Chai Wah Wu, Jan 10 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jan 08 2024
STATUS
approved