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

A056453 Number of palindromes of length n using exactly two different symbols.

Original entry on oeis.org

0, 0, 2, 2, 6, 6, 14, 14, 30, 30, 62, 62, 126, 126, 254, 254, 510, 510, 1022, 1022, 2046, 2046, 4094, 4094, 8190, 8190, 16382, 16382, 32766, 32766, 65534, 65534, 131070, 131070, 262142, 262142, 524286, 524286, 1048574, 1048574, 2097150, 2097150, 4194302
Offset: 1

Views

Author

Keywords

Comments

Also the number of bitstrings of length n+2 where the last two runs have the same length. (A run is a maximal subsequence of (possibly just one) identical bits.) - David Nacin, Mar 03 2012
Also, the decimal representation of the diagonal from the corner to the origin of the n-th stage of growth of the two-dimensional cellular automaton defined by "Rule 62", based on the 5-celled von Neumann neighborhood, initialized with a single black (ON) cell at stage zero. - Robert Price, Apr 22 2017

Examples

			The palindromes in two symbols of length three take the forms 000, 111, 010, 101. Of these only two have exactly two symbols.  Thus a(3) = 2. - _David Nacin_, Mar 03 2012
		

References

  • M. R. Nester (1999). Mathematical investigations of some plant interaction designs. PhD Thesis. University of Queensland, Brisbane, Australia. [See A056391 for pdf file of Chap. 2]
  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 170.

Crossrefs

Programs

  • Magma
    [2^Floor((n+1)/2)-2: n in [1..40]]; // Vincenzo Librandi, Aug 16 2011
    
  • Mathematica
    Table[2^(Floor[n/2] + 1) - 2, {n, 0, 40}] (* David Nacin, Mar 03 2012 *)
    LinearRecurrence[{1, 2, -2}, {0, 0, 2}, 40] (* David Nacin, Mar 03 2012 *)
    k=2; Table[k! StirlingS2[Ceiling[n/2],k],{n,1,30}] (* Robert A. Russell, Sep 25 2018 *)
  • PARI
    a(n) = 2^((n+1)\2)-2; \\ Altug Alkan, Sep 25 2018
    
  • Python
    def A056453(n): return (1<<(n+1>>1))-2 # Chai Wah Wu, Feb 18 2024

Formula

a(n) = 2^floor((n+1)/2) - 2.
a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3). - David Nacin, Mar 03 2012
G.f.: 2*x^3/((1-x)*(1-2*x^2)). - David Nacin, Mar 03 2012
G.f.: k!(x^(2k-1)+x^(2k))/Product_{i=1..k}(1-ix^2), where k=2 is the number of symbols. - Robert A. Russell, Sep 25 2018
a(n) = k! S2(ceiling(n/2),k), where k=2 is the number of symbols and S2 is the Stirling subset number. - Robert A. Russell, Sep 25 2018
E.g.f.: 1 - 2*cosh(x) + cosh(sqrt(2)*x) - 2*sinh(x) + sqrt(2)*sinh(sqrt(2)*x). - Stefano Spezia, Jun 06 2023

Extensions

More terms from Vincenzo Librandi, Aug 16 2011
Name clarified by Michel Marcus and Felix Fröhlich, Jul 09 2018

A208900 Number of bitstrings of length n which (if having two or more runs) the last two runs have different lengths.

Original entry on oeis.org

2, 2, 6, 10, 26, 50, 114, 226, 482, 962, 1986, 3970, 8066, 16130, 32514, 65026, 130562, 261122, 523266, 1046530, 2095106, 4190210, 8384514, 16769026, 33546242, 67092482, 134201346, 268402690, 536838146, 1073676290, 2147418114, 4294836226, 8589803522
Offset: 1

Views

Author

David Nacin, Mar 03 2012

Keywords

Comments

A run is a maximal subsequence of (possibly just one) identical bits.

Examples

			If n=3 the bitstrings where the last runs have different lengths are 111,000,100,011,110,001 so a(3) = 6.
		

Crossrefs

Programs

  • Mathematica
    Table[2 + 2^n - 2^(Floor[n/2] + 1) ,  {n, 1, 40}]
    LinearRecurrence[{3, 0, -6, 4}, {2, 2, 6, 10}, 40]

Formula

a(n) = 2^n + 2 - 2^(floor(n/2)+1).
a(n) = 3*a(n-1) - 6*a(n-3) + 4*a(n-4), a(0) = 2, a(1) = 2, a(2) = 6, a(3) = 10.
G.f.: x*(2 - 4*x + 4*x^3)/((1-x)*(1-2*x^2)*(1-2*x)).
E.g.f.: - 2*cosh(sqrt(2)*x) + 2*exp(x)*(1 + sinh(x)) - sqrt(2)*sinh(sqrt(2)*x). - Stefano Spezia, Jun 06 2023

A208902 The sum over all bitstrings b of length n of the number of runs in b not immediately followed by a longer run.

Original entry on oeis.org

2, 6, 14, 34, 78, 182, 414, 942, 2110, 4702, 10366, 22718, 49406, 106878, 229886, 492286, 1049598, 2229758, 4720638, 9964542, 20975614, 44046334, 92282878, 192950270, 402669566, 838885374, 1744863230, 3623927806, 7516258302, 15569354750, 32212385790
Offset: 1

Views

Author

David Nacin, Mar 03 2012

Keywords

Comments

A run is a maximal subsequence of (possibly just one) identical bits.

Examples

			When n=3, 000,111 each have 1 such run, 101,010 each have 3, 100,011 each have 1, 001, 110 each have 2, summing these gives 2+6+2+4=14 so a(3) = 14.
		

Crossrefs

Programs

  • Mathematica
    Table[2^n*(2 + (n - 1)/2 - (1/2)^(n - 1) - 2*(1 - (1/2)^Floor[n/2]) + (1/2)^(Floor[n/2] + 1) (1 + (-1)^n)), {n, 1, 40}]
    LinearRecurrence[{5, -6, -6, 16, -8}, {2, 6, 14, 34, 78}, 40]

Formula

a(n) = 2^n * (2 + (n - 1)/2 - (1/2)^(n - 1) - 2 (1 - (1/2)^floor(n/2)) + (1/2)^(floor(n/2) + 1) (1 + (-1)^n)).
a(n) = A208903(n) + 2.
a(n) = 5*a(n-1) - 6*a(n-2) - 6*a(n-3) + 16*a(n-4) - 8*a(n-5), a(1) = 2, a(2) = 6, a(3) = 14, a(4) = 34, a(5) = 78.
G.f.: (2 - 4*x - 4*x^2 + 12*x^3 - 4*x^4)/(1 - 5*x + 6*x^2 + 6*x^3 - 16*x^4 + 8*x^5).

A208903 The sum over all bitstrings b of length n with at least two runs of the number of runs in b not immediately followed by a longer run.

Original entry on oeis.org

0, 4, 12, 32, 76, 180, 412, 940, 2108, 4700, 10364, 22716, 49404, 106876, 229884, 492284, 1049596, 2229756, 4720636, 9964540, 20975612, 44046332, 92282876, 192950268, 402669564, 838885372, 1744863228, 3623927804, 7516258300, 15569354748, 32212385788
Offset: 1

Views

Author

David Nacin, Mar 03 2012

Keywords

Comments

A run is a maximal subsequence of (possibly just one) identical bits.

Examples

			n=3: 101, 010 each have 3; 100, 011 each have 1; 001, 110 each have 2. (000, 111 do not have at least two runs so they do not contribute.) Summing these gives 6+2+4 = 12 so a(3) = 12.
		

Crossrefs

Programs

  • Mathematica
    Table[2^n*(2 + (n-1)/2 - (1/2)^(n-1) - 2*(1 - (1/2)^Floor[n/2]) + (1/2)^(Floor[n/2] + 1) (1 + (-1)^n)) - 2, {n, 1, 40}]
    LinearRecurrence[{5, -6, -6, 16, -8}, {0, 4, 12, 32, 76}, 40]

Formula

a(n) = 2^n * (2 + (n - 1)/2 - (1/2)^(n - 1) - 2 (1 - (1/2)^floor(n/2)) + (1/2)^(floor(n/2) + 1) (1 + (-1)^n)) - 2.
a(n) = A208902(n) - 2.
a(n) = 5*a(n-1) - 6*a(n-2) - 6*a(n-3) + 16*a(n-4) - 8*a(n-5), a(1) = 0, a(2) = 4, a(3) = 12, a(4) = 32, a(5) = 76.
G.f.: (4*x - 8*x^2 - 4*x^3 + 12*x^4)/(1 - 5*x + 6*x^2 + 6*x^3 - 16*x^4 +
8*x^5).
Showing 1-4 of 4 results.