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.

A007057 Let S denote the palindromes in the language {0,1,2,3}*; a(n) = number of words of length n in the language SS.

This page as a plain text file.
%I A007057 M3510 #27 Feb 19 2024 11:49:56
%S A007057 1,4,16,40,136,304,880,1768,4936,9112,25216,45016,121600,212944,
%T A007057 571552,982240,2616136,4456384,11785408,19922872,52402336,88076560,
%U A007057 230641504,385875880,1006499200,1677720304,4361862976,7247738776,18789905872,31138512784,80529599680,133143986056,343594756936
%N A007057 Let S denote the palindromes in the language {0,1,2,3}*; a(n) = number of words of length n in the language SS.
%D A007057 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A007057 R. Kemp, <a href="http://dx.doi.org/10.1016/0012-365X(82)90123-6">On the number of words in the language {w in Sigma* | w = w^R }^2</a>, Discrete Math., 40 (1982), 225-234.
%F A007057 a(n) = A187274(n) - Sum_{d|n,d<n} phi(n/d)*a(d). - _Sean A. Irvine_, Sep 27 2017
%p A007057 See A007055.
%o A007057 (Python)
%o A007057 from functools import lru_cache
%o A007057 from sympy import totient, proper_divisors
%o A007057 @lru_cache(maxsize=None)
%o A007057 def A007057(n): return (n<<n+1 if n&1 else 5*(n>>1)<<n)-sum(totient(n//d)*A007057(d) for d in proper_divisors(n,generator=True)) if n else 1 # _Chai Wah Wu_, Feb 19 2024
%Y A007057 Column 4 of A284873.
%K A007057 nonn
%O A007057 0,2
%A A007057 _N. J. A. Sloane_, _Mira Bernstein_, R. Kemp
%E A007057 Entry revised by _N. J. A. Sloane_, Mar 07 2011