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!)
A112511 Greatest n-bit number whose binary representation's substrings represent the maximal number (A112509(n)) of distinct integers. 6
1, 2, 6, 14, 29, 61, 123, 244, 500, 1004, 2009, 4057, 8121, 16243, 32627, 65267, 130535, 261066, 523210, 1046474, 2092954, 4185909, 8371816, 16760424, 33521256, 67042536, 134085073, 268302801, 536607185, 1073214417, 2146428840 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
See A112509 for a full explanation and example.
LINKS
2008/9 British Mathematical Olympiad Round 2, Problem 4, Jan 29 2009.
PROG
(Python)
from itertools import product
def c(w):
return len(set(w[i:j+1] for i in range(len(w)) if w[i] != "0" for j in range(i, len(w)))) + int("0" in w)
def a(n):
m, argm = -1, None
for b in product("01", repeat=n-1):
v = c("1"+"".join(b))
if v >= m:
m, argm = v, int("1"+"".join(b), 2)
return argm
print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Jan 13 2023
CROSSREFS
Cf. A112509 (corresponding maximum), A112510 (least n-bit number for which this maximum occurs).
Sequence in context: A169948 A192705 A123991 * A143702 A063452 A009299
KEYWORD
base,nonn
AUTHOR
Rick L. Shepherd, Sep 09 2005
EXTENSIONS
a(21)-a(31) from Joseph Myers, Feb 01 2009
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 April 19 05:19 EDT 2024. Contains 371782 sequences. (Running on oeis4.)