login
A056453
Number of palindromes of length n using exactly two different symbols.
15
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,3
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
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.
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
EXAMPLE
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
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 *)
PROG
(Magma) [2^Floor((n+1)/2)-2: n in [1..40]]; // Vincenzo Librandi, Aug 16 2011
(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
KEYWORD
nonn,easy
EXTENSIONS
More terms from Vincenzo Librandi, Aug 16 2011
Name clarified by Michel Marcus and Felix Fröhlich, Jul 09 2018
STATUS
approved