The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A368857 a(n) gives the maximum number of equally spaced equal digits in the binary expansion of n (without leading zeros). 2
0, 1, 1, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 3, 4, 4, 3, 2, 2, 2, 3, 2, 3, 3, 2, 2, 2, 3, 3, 4, 5, 5, 4, 3, 3, 2, 2, 2, 3, 3, 2, 3, 3, 2, 2, 3, 4, 4, 3, 2, 2, 2, 3, 2, 3, 3, 3, 3, 3, 4, 4, 5, 6, 6, 5, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 4, 4, 3, 2, 2, 3, 4, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
COMMENTS
This sequence diverges to infinity by Van der Waerden's theorem.
LINKS
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
Cf. A368841.
Sequence in context: A292137 A292138 A322665 * A273632 A347387 A196046
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jan 08 2024
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 21 05:34 EDT 2024. Contains 372728 sequences. (Running on oeis4.)