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!)
A141297 a(n) = number of distinct (nonempty) substrings in the binary representation of n. 6

%I #35 Jul 25 2024 20:44:27

%S 1,3,2,5,5,5,3,7,8,7,8,8,8,7,4,9,11,11,12,11,9,11,11,11,12,11,11,11,

%T 11,9,5,11,14,15,16,14,15,16,16,15,15,11,14,16,14,15,14,14,16,16,16,

%U 16,14,14,15,15,16,15,15,14,14,11,6,13,17,19,20,19,20,21,21,19,17,19,21,20,21

%N a(n) = number of distinct (nonempty) substrings in the binary representation of n.

%C Substrings may start with a 0.

%C The terms were calculated by _R. J. Mathar_.

%C Also: "complexité par facteurs" of n written in base 2. [_Alexandre Wajnberg_, Aug 22 2011]

%H Alois P. Heinz, <a href="/A141297/b141297.txt">Table of n, a(n) for n = 1..10000</a>

%H Jean-Paul Delahaye, <a href="http://www.mathrix.org/zenil/PLSZenilDelahaye.pdf">Le défi des faibles complexités</a>, Pour la Science, 405 (2011), p. 82-87.

%F a(2^k - 1) = k - 1 for any k >= 0. - _Rémy Sigrist_, Jan 20 2021

%e The distinct substrings in binary representation (1010) of decimal 10 are 0,1,10,01,101,010,1010. So a(10) = 7.

%p a:= n-> (s-> nops({seq(seq(s[i..j], i=1..j),

%p j=1..length(s))}))(""||(convert(n, binary))):

%p seq(a(n), n=1..84); # _Alois P. Heinz_, Jan 20 2021

%t Table[With[{d = IntegerDigits[n, 2]}, Length@ Union@ Apply[Join, Table[Partition[d, k, 1], {k, Length@ d}]]], {n, 77}] (* _Michael De Vlieger_, Sep 22 2017 *)

%o (Python)

%o def a(n):

%o b = bin(n)[2:]

%o m = len(b)

%o return len(set(b[i:j] for i in range(m) for j in range(i+1, m+1)))

%o print([a(n) for n in range(1, 78)]) # _Michael S. Branicky_, Jan 20 2021

%Y Cf. A078822, A141298, A141299, A141300, A122953.

%K nonn,look,base

%O 1,2

%A _Leroy Quet_, Jun 24 2008

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 September 11 06:30 EDT 2024. Contains 375814 sequences. (Running on oeis4.)