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.

Showing 1-3 of 3 results.

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

Original entry on oeis.org

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, 11, 9, 5, 11, 14, 15, 16, 14, 15, 16, 16, 15, 15, 11, 14, 16, 14, 15, 14, 14, 16, 16, 16, 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
Offset: 1

Views

Author

Leroy Quet, Jun 24 2008

Keywords

Comments

Substrings may start with a 0.
The terms were calculated by R. J. Mathar.
Also: "complexité par facteurs" of n written in base 2. [Alexandre Wajnberg, Aug 22 2011]

Examples

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

Crossrefs

Programs

  • Maple
    a:= n-> (s-> nops({seq(seq(s[i..j], i=1..j),
        j=1..length(s))}))(""||(convert(n, binary))):
    seq(a(n), n=1..84);  # Alois P. Heinz, Jan 20 2021
  • Mathematica
    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 *)
  • Python
    def a(n):
      b = bin(n)[2:]
      m = len(b)
      return len(set(b[i:j] for i in range(m) for j in range(i+1, m+1)))
    print([a(n) for n in range(1, 78)]) # Michael S. Branicky, Jan 20 2021

Formula

a(2^k - 1) = k - 1 for any k >= 0. - Rémy Sigrist, Jan 20 2021

A141298 a(n) = number of distinct substrings in the binary representation of n that each occur multiple times.

Original entry on oeis.org

0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 1, 2, 1, 2, 3, 3, 3, 3, 2, 3, 5, 3, 2, 3, 2, 3, 2, 3, 2, 3, 4, 4, 4, 4, 3, 5, 4, 3, 3, 4, 4, 7, 5, 3, 5, 4, 3, 4, 3, 3, 3, 3, 5, 5, 2, 4, 3, 4, 2, 4, 3, 4, 5, 5, 5, 5, 4, 5, 5, 4, 4, 5, 8, 5, 4, 5, 4, 4, 4, 5, 5, 5, 4, 7, 9, 5, 6, 4, 4, 5, 8, 4, 6, 5, 4, 5, 4, 4, 4, 5, 4, 5, 3, 4, 4
Offset: 1

Views

Author

Leroy Quet, Jun 24 2008

Keywords

Comments

Substrings may start with a 0.

Examples

			The distinct substrings that occur multiple times in decimal 10 = binary 1010 are 0,1 and 10. So a(10)=3.
		

Crossrefs

Programs

Extensions

Extended by Ray Chandler, Jun 25 2009

A141299 a(n) = number (with repetition) of (not necessarily distinct) substrings in the binary representation of n that each occur multiple times.

Original entry on oeis.org

0, 0, 2, 2, 2, 2, 5, 5, 4, 6, 3, 4, 3, 5, 9, 9, 7, 7, 5, 7, 11, 7, 6, 7, 5, 7, 6, 7, 6, 9, 14, 14, 11, 10, 8, 12, 10, 8, 8, 10, 10, 17, 12, 8, 12, 10, 10, 11, 8, 8, 8, 8, 12, 12, 8, 10, 8, 10, 8, 11, 10, 14, 20, 20, 16, 14, 12, 14, 13, 11, 11, 14, 19, 14, 11, 13, 11, 11, 12, 14, 13, 14, 11
Offset: 1

Views

Author

Leroy Quet, Jun 24 2008

Keywords

Comments

Substrings may start with a 0.

Examples

			0,0,1,1,10,10 each occur multiple times in binary 1010 = decimal 10. So a(10) = 6.
		

Crossrefs

Programs

  • Mathematica
    Array[Function[d, Total@ Select[Tally@ Apply[Join, Map[Partition[d, #, 1] &, Range[Length@ d - 1]]], Last@ # > 1 &][[All, -1]]]@ IntegerDigits[#, 2] &, 83] (* Michael De Vlieger, Oct 23 2017 *)

Extensions

Extended by Ray Chandler, Jun 25 2009
Showing 1-3 of 3 results.