cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A112511 Greatest n-bit number whose binary representation's substrings represent the maximal number (A112509(n)) of distinct integers.

This page as a plain text file.
%I A112511 #16 Jul 24 2025 16:55:19
%S A112511 1,2,6,14,29,61,123,244,500,1004,2009,4057,8121,16243,32627,65267,
%T A112511 130535,261066,523210,1046474,2092954,4185909,8371816,16760424,
%U A112511 33521256,67042536,134085073,268302801,536607185,1073214417,2146428840,4292857688,8585715377,17175649969
%N A112511 Greatest n-bit number whose binary representation's substrings represent the maximal number (A112509(n)) of distinct integers.
%C A112511 See A112509 for a full explanation and example.
%H A112511 Martin Fuller, <a href="/A112511/b112511.txt">Table of n, a(n) for n = 1..80</a>
%H A112511 2008/9 British Mathematical Olympiad Round 2, <a href="http://www.bmoc.maths.org/home/bmo2-2009.pdf">Problem 4</a>, Jan 29 2009.
%o A112511 (Python)
%o A112511 from itertools import product
%o A112511 def c(w):
%o A112511     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)
%o A112511 def a(n):
%o A112511     m, argm = -1, None
%o A112511     for b in product("01", repeat=n-1):
%o A112511         v = c("1"+"".join(b))
%o A112511         if v >= m:
%o A112511             m, argm = v, int("1"+"".join(b), 2)
%o A112511     return argm
%o A112511 print([a(n) for n in range(1, 21)]) # _Michael S. Branicky_, Jan 13 2023
%Y A112511 Cf. A112509 (corresponding maximum), A112510 (least n-bit number for which this maximum occurs).
%Y A112511 A078822, A122953, A156022, A156023, A156024, A156025. [From _Joseph Myers_, Feb 01 2009]
%K A112511 base,nonn
%O A112511 1,2
%A A112511 _Rick L. Shepherd_, Sep 09 2005
%E A112511 a(21)-a(31) from _Joseph Myers_, Feb 01 2009
%E A112511 a(32) onwards from _Martin Fuller_, Jul 24 2025