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-6 of 6 results.

A134457 a(n) = number of length-n binary strings with A006697(n) distinct substrings.

Original entry on oeis.org

1, 2, 2, 6, 8, 4, 18, 38, 48, 40, 16, 80, 210, 402, 644, 852, 928, 912, 704, 256, 1344, 3944, 9276, 19448, 37090, 65602, 107388, 160760, 220200
Offset: 0

Views

Author

David W. Wilson, Dec 17 2007

Keywords

Comments

Here by "substring" one means a contiguous block within a string (often called "subword" or "factor").

Examples

			Table giving n, A006697(n) = maximal number of distinct substrings of a binary string of length n, a(n), c(n) = lexically first length-n binary string with A006697(n) distinct substrings.
n A006697(n) a(n) c(n)
0 1 1 null
1 2 2 0
2 4 2 01
3 6 6 001
4 9 8 0010
5 13 4 00110
6 17 18 000110
7 22 38 0001011
8 28 48 00010110
9 35 40 000101100
10 43 16 0001011100
11 51 80 00001011100
12 60 210 000010011101
13 70 402 0000100110111
14 81 644 00001001101110
15 93 852 000010011010111
16 106 928 0000100110101110
17 120 912 00001001101011100
18 135 704 000010011010111000
19 151 256 0000100110101111000
20 167 1344 00000100110101111000
21 184 3944 000001000110101111001
22 202 9276 0000010001100101111010
23 221 19448 00000100011001010111101
24 241 37090 000001000110010101111010
25 262 65602 0000010001100101001111011
26 284 107388 00000100011001010011101111
27 307 160760 000001000110010100111011110
28 331 220200 0000010001100101001110101111
For (conjectural?) further values see the _Martin Fuller_ link.
		

Crossrefs

Cf. A006697, A134466(n) = decimal value of c(n) interpreted as a binary number.

Extensions

Link to comments on history of the problem added by Jeffrey Shallit, May 08 2016

A079559 Number of partitions of n into distinct parts of the form 2^j-1, j=1,2,....

Original entry on oeis.org

1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1
Offset: 0

Views

Author

Vladeta Jovovic, Jan 25 2003

Keywords

Comments

Differences of the Meta-Fibonacci sequence for s=0. - Frank Ruskey and Chris Deugau (deugaucj(AT)uvic.ca)
Fixed point of morphism 0-->0, 1-->110 - Joerg Arndt, Jun 07 2007
A006697(k) gives number of distinct subwords of length k, conjectured to be equal to A094913(k)+1. - M. F. Hasler, Dec 19 2007
Characteristic function for the range of A005187: a(A055938(n))=0; a(A005187(n))=1; if a(m)=1 then either a(m-1)=1 or a(m+1)=1. - Reinhard Zumkeller, Mar 18 2009
The number of zeros between successive pairs of ones in this sequence is A007814. - Franklin T. Adams-Watters, Oct 05 2011
Length of n-th run = abs(A088705) + 1. - Reinhard Zumkeller, Dec 11 2011

Examples

			a(11)=1 because we have [7,3,1].
G.f. = 1 + x + x^3 + x^4 + x^7 + x^8 + x^10 + x^11 + x^15 + x^16 + x^18 + ...
From _Omar E. Pol_, Nov 30 2009: (Start)
The sequence, displayed as irregular triangle, in which rows length are powers of 2, begins:
1;
1,0;
1,1,0,0;
1,1,0,1,1,0,0,0;
1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,0;
1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,0,0;
1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,0,0,0;
(End)
		

Crossrefs

Programs

  • Haskell
    a079559 = p $ tail a000225_list where
       p _      0 = 1
       p (k:ks) m = if m < k then 0 else p ks (m - k) + p ks m
    -- Reinhard Zumkeller, Dec 11 2011
    
  • Haskell
    a079559_list = 1 : f [1] where
       f xs = ys ++ f ys where ys = init xs ++ [1] ++ tail xs ++ [0]
    -- Reinhard Zumkeller, May 05 2015
    
  • Maple
    g:=product(1+x^(2^n-1),n=1..15): gser:=series(g,x=0,110): seq(coeff(gser,x,n),n=0..104); # Emeric Deutsch, Apr 06 2006
    d := n -> if n=1 then 1 else A046699(n)-A046699(n-1) fi; # Frank Ruskey and Chris Deugau (deugaucj(AT)uvic.ca)
  • Mathematica
    row[1] = {1}; row[2] = {1, 0}; row[n_] := row[n] = row[n-1] /. 1 -> Sequence[1, 1, 0]; Table[row[n], {n, 1, 7}] // Flatten (* Jean-François Alcover, Jul 30 2012, after Omar E. Pol *)
    CoefficientList[ Series[ Product[1 + x^(2^n - 1), {n, 6}], {x, 0, 104}], x] (* or *)
    Nest[ Flatten[# /. {0 -> {0}, 1 -> {1, 1, 0}}] &, {1}, 6] (* Robert G. Wilson v, Sep 08 2014 *)
  • PARI
    w="1,";for(i=1,5,print1(w=concat([w,w,"0,"])))
    
  • PARI
    A079559(n,w=[1])=until(n<#w=concat([w,w,[0]]),);w[n+1] \\ M. F. Hasler, Dec 19 2007
    
  • PARI
    {a(n) = if( n<0, 0, polcoeff( prod(k=1, #binary(n+1), 1 + x^(2^k-1), 1 + x * O(x^n)), n))} /* Michael Somos, Aug 03 2009 */
    
  • Python
    def a053644(n): return 0 if n==0 else 2**(len(bin(n)[2:]) - 1)
    def a043545(n):
        x=bin(n)[2:]
        return int(max(x)) - int(min(x))
    l=[1]
    for n in range(1, 101): l+=[a043545(n + 1)*l[n + 1 - a053644(n + 1)], ]
    print(l) # Indranil Ghosh, Jun 11 2017

Formula

G.f.: Product_{n>=1} (1 + x^(2^n-1)).
a(n) = 1 if n=0, otherwise A043545(n+1)*a(n+1-A053644(n+1)). - Reinhard Zumkeller, Aug 19 2006
a(n) = p(n,1) with p(n,k) = p(n-k,2*k+1) + p(n,2*k+1) if k <= n, otherwise 0^n. - Reinhard Zumkeller, Mar 18 2009
Euler transform is sequence A111113 sequence offset -1. - Michael Somos, Aug 03 2009
G.f.: Product_{k>0} (1 - x^k)^-A111113(k+1). - Michael Somos, Aug 03 2009
a(n) = A108918(n+1) mod 2. - Joerg Arndt, Apr 06 2011
a(n) = A000035(A153000(n)), n >= 1. - Omar E. Pol, Nov 29 2009, Aug 06 2013

Extensions

Edited by M. F. Hasler, Jan 03 2008

A005942 a(2n) = a(n) + a(n+1), a(2n+1) = 2a(n+1), if n >= 2.

Original entry on oeis.org

1, 2, 4, 6, 10, 12, 16, 20, 22, 24, 28, 32, 36, 40, 42, 44, 46, 48, 52, 56, 60, 64, 68, 72, 76, 80, 82, 84, 86, 88, 90, 92, 94, 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 148, 152, 156, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182
Offset: 0

Views

Author

Keywords

Comments

a(n) is the subword complexity (or factor complexity) of Thue-Morse sequence A010060, that is, the number of factors of length n in A010060. See Allouche-Shallit (2003). - N. J. A. Sloane, Jul 10 2012

References

  • J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003. See Problem 10, p. 335. - From N. J. A. Sloane, Jul 10 2012
  • J. Berstel et al., Combinatorics on Words: Christoffel Words and Repetitions in Words, Amer. Math. Soc., 2008. See p. 83.
  • Michel Rigo, Formal Languages, Automata and Numeration Systems, 2 vols., Wiley, 2014. Mentions this sequence - see "List of Sequences" in Vol. 2.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a005942 n = a005942_list !! n
    a005942_list = 1 : 2 : 4 : 6 : zipWith (+) (drop 6 ts) (drop 5 ts) where
       ts = concat $ transpose [a005942_list, a005942_list]
    -- Reinhard Zumkeller, Nov 15 2012
  • Mathematica
    a[0] = 1; a[1] = 2; a[2] = 4; a[3] = 6; a[n_?EvenQ] := a[n] = a[n/2] + a[n/2 + 1]; a[n_?OddQ]  := a[n] = 2*a[(n + 1)/2]; Array[a,60,0] (* Jean-François Alcover, Apr 11 2011 *)
  • PARI
    a(n)=if(n<4,2*max(0,n)+(n==0),if(n%2,2*a((n+1)/2),a(n/2)+a(n/2+1)))
    

Formula

a(n) = 2*(A006165(n-1) + n - 1), n > 1.
G.f. (1+x^2)/(1-x)^2 + 2*x^2/(1-x)^2 * Sum_{k>=0} (x^2^(k+1)-x^(3*2^k)). - Ralf Stephan, Jun 04 2003
For n > 2, a(n) = 3*(n-1) + A053646(n-1). - Max Alekseyev, May 15 2011
a(n) = 2*A275202(n-1) for n > 1. - N. J. A. Sloane, Jun 04 2019

Extensions

Typo in definition corrected by Reinhard Zumkeller, Nov 15 2012

A103354 a(n) = floor(x), where x is the solution to x = 2^(n-x).

Original entry on oeis.org

1, 1, 2, 2, 3, 4, 4, 5, 6, 7, 8, 8, 9, 10, 11, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 64, 65, 66, 67
Offset: 1

Views

Author

N. J. A. Sloane, Mar 21 2005

Keywords

Comments

Partial sums seem to be A006697(n-1) = A094913(n-1) + 1. - M. F. Hasler, Dec 14 2007 [Confirmed by Allouche and Shallit, 2016. - N. J. A. Sloane, Mar 24 2017]

Crossrefs

Cf. A006697 (partial sums), A094913.

Programs

  • Maple
    A[1]:= 1;
    for n from 2 to 100 do
      for x from A[n-1]  while x <= 2^(n-x) do od;
      A[n]:= x-1;
    od:
    seq(A[i],i=1..100); # Robert Israel, Dec 04 2016
  • Mathematica
    a[n_] := Floor[ FullSimplify[ ProductLog[ 2^n*Log[2]]/Log[2]]]; Table[a[n], {n, 1, 74}] (* Jean-François Alcover, Dec 13 2011, after M. F. Hasler *)
  • PARI
    A103354(n)=floor(solve(X=1,log(n)*2,X-2^(n-X))+1e-9) \\ M. F. Hasler, Dec 14 2007
    
  • PARI
    A103354(n)=floor(n-log(n)/log(2)*(1-1.5/n)) \\ M. F. Hasler, Dec 14 2007

Formula

a(n) is approximately n/(1+log_2(n)/n).
a(n) = floor(LambertW(log(2)*2^n)/log(2)) = floor(n - log_2(n) + log_2(n)/(n log(2)) + O((log(n)/n)^2)) = floor(n - log_2(n) + 1.5*log_2(n)/n) at least for all n < 10^7. - M. F. Hasler, Dec 14 2007

Extensions

Edited by M. F. Hasler, Dec 14 2007

A005943 Factor complexity (number of subwords of length n) of the Golay-Rudin-Shapiro binary word A020987.

Original entry on oeis.org

1, 2, 4, 8, 16, 24, 36, 46, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264, 272, 280, 288, 296, 304, 312, 320, 328, 336, 344, 352, 360, 368, 376, 384, 392, 400, 408, 416, 424, 432, 440, 448, 456, 464, 472, 480, 488, 496, 504
Offset: 0

Views

Author

Keywords

Comments

Terms a(0)..a(13) were verified and terms a(14)..a(32) were computed using the first 2^32 terms of the GRS sequence. - Joerg Arndt, Jun 10 2012
Terms a(0)..a(63) were computed using the first 2^36 terms of the GRS sequence, and are consistent with Arndt's conjectured g.f. - Sean A. Irvine, Oct 12 2016

Examples

			All 8 subwords of length three (000, 001, ..., 111) occur in A020987, so a(3) = 8.
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A006697, A005942, A337120 (paperfolding).

Programs

  • Maple
    # Naive Maple program, useful for getting initial terms of factor complexity FC of a sequence b1[]. N. J. A. Sloane, Jun 04 2019
    FC:=[0]; # a(0)=0 from the empty subword
    for L from 1 to 12 do
      lis := {};
      for n from 1 to nops(b1)-L do
        s:=[seq(b1[i],i=n..n+L-1)];
        lis:={op(lis),s}; od:
    FC:=[op(FC),nops(lis)];
    od:
    FC;
  • Mathematica
    CoefficientList[Series[(1 + x^2 + 2 x^3 + 4 x^4 + 4 x^6 - 2 x^7 - 2 x^9)/(1 - x)^2, {x, 0, 64}], x] (* Michael De Vlieger, Oct 14 2021 *)
  • PARI
    first(n) = n = max(n, 10); concat([1, 2, 4, 8, 16, 24, 36, 46], vector(n-8,i,8*i+48)) \\ David A. Corneth, Apr 28 2021

Formula

G.f.: (1+x^2+2*x^3+4*x^4+4*x^6-2*x^7-2*x^9)/(1-x)^2. - Joerg Arndt, Jun 10 2012
From Kevin Ryde, Aug 18 2020: (Start)
a(1..7) = 2,4,8,16,24,36,46, then a(n) = 8*n - 8 for n>=8. [Allouche]
a(n) = 2*A337120(n-1) for n>=1. [Allouche, end of proof of theorem 2]
(End)

Extensions

Minor edits by N. J. A. Sloane, Jun 06 2012
a(14)-a(32) added by Joerg Arndt, Jun 10 2012
a(33)-a(36) added by Joerg Arndt, Oct 28 2012

A094913 Maximal number of distinct nonempty substrings of any binary string of length n.

Original entry on oeis.org

0, 1, 3, 5, 8, 12, 16, 21, 27, 34, 42, 50, 59, 69, 80, 92, 105, 119, 134, 150, 166, 183, 201, 220, 240, 261, 283, 306, 330
Offset: 0

Views

Author

John W. Layman, Jun 17 2004

Keywords

Comments

It would be more natural to include the empty substring, which would result in the sequence b(n)=a(n)+1; all values computed so far confirm the conjecture that a(n)+1 = A006697(n). - M. F. Hasler, Dec 17 2007
In addition to the example given, computation finds 17 other binary strings of length 6 which contain the maximal number a(6)=16 of distinct substrings. Interestingly, each of the 18 such instances gives the same numbers of substrings of each possible length, in this case 2,4,4,3,2,1 substrings of lengths 1 through 6, respectively.
Calculations suggest that, for any n>0, binary strings of length n exist such that the number of distinct substrings of length k, 1<=k<=n, is as large as possible consistent with basic counting principles, i.e., n-k+1 substrings of length k starting at each of the n-k+1 possible starting positions, subject to the condition, however, that there cannot be more than 2^k distinct binary strings of length k. This suggests the following conjecture. Conjecture: The maximum number a(n) of distinct substrings of a binary string of length n is given by a(n) = Sum_{k=1..n} t(k) where t(k) is the smaller of 2^k and n-k+1.
Conjecture: a(n) = A006697(n)-1. - Vladeta Jovovic, Sep 19 2005
Conjecture: a(n) = 2^(m+1)-2 + (n-m)(n-m+1)/2, where m = floor(n+1-LambertW( 2^(n+1) * log(2) ) / log(2) ) = integer part of the solution to 2^x = n+1-x. This is based on the reasoning that you can construct the word of length n so that it contains the maximal possible number, max( n-k+1, 2^k ), of different substrings of length k. - M. F. Hasler, Dec 17 2007
From Peter Pein (petsie(AT)dordos.net), Jan 18 2008: (Start)
The following heuristic seems to work for computing the maximal number of distinct substrings of a binary string of length n.
Start with the empty list and at each step try to insert a zero or a one at each possible position. Then pick the first list with the maximal number of sublists and start over.
Say we have had {0,0,1,1,0} as one of the lists with the maximal number of sublists. Then my candidates for the next test are:
With[{lastbest = {0, 0, 1, 1, 0}}, Union[Flatten[ Outer[Insert[lastbest, #2, #1] &, Range[1 + Length[lastbest]], {0, 1}, 1], 1]]]
{{0, 0, 0, 1, 1, 0}, {0, 0, 1, 0, 1, 0}, {0, 0, 1, 1, 0, 0}, {0, 0, 1, 1, 0, 1}, {0, 0, 1, 1, 1, 0}, {0, 1, 0, 1, 1, 0}, {1, 0, 0, 1, 1, 0}}
See http://freenet-homepage.de/Peter_Berlin/Mathe/heuristicA094913.nb for the Mathematica notebook with the complete (simple) algorithm. There's a screenshot too (same URL but with .png instead of .nb).
If this works correctly, the first 100 values of A094913 are calculated in 30 secs.
(End) [See also the remarks in the Fuller link in A134457.]
From Jon Perry, Nov 16 2010: (Start)
Conjecture: column sums of:
1 3 5 7 9 11 13 ...
1 3 5 7 ...
1 ...
....................
--------------------
1 3 5 8 12 16 21 ... (End)

Examples

			The binary string 000110 of length 6 contains the 16 distinct substrings 0, 1, 00, 01, 11, 10, 000, 001, 011, 110, 0001, 0011, 0110, 00011, 00110, 000110 and a computer search shows that no other binary string of length 6 contains more than 16. Thus a(6)=16.
G.f. = x + 3*x^2 + 5*x^3 + 8*x^4 + 12*x^5 + 16*x^6 + 21*x^7 + 27*x^8 + 34*x^9 + ...
		

Crossrefs

Programs

Extensions

a(19)-a(28) from David W. Wilson, Dec 17 2007
More references (some proving some conjectures) added by Jeffrey Shallit, Nov 21 2015
Showing 1-6 of 6 results.