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.

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

This page as a plain text file.
%I A007056 M2781 #27 Feb 19 2024 11:51:43
%S A007056 1,3,9,21,57,123,279,549,1209,2127,4689,7989,17031,28395,60615,98061,
%T A007056 208569,334563,705789,1121877,2356737,3718827,7786359,12223077,
%U A007056 25488903,39857523,82876257,129135729,267784119,416118219,860825439,1334448261,2754778809,4261609131,8781196329,13559714109,27893530029
%N A007056 Let S denote the palindromes in the language {0,1,2}*; a(n) = number of words of length n in the language SS.
%D A007056 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A007056 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 A007056 a(n) = A187273(n) - Sum_{d|n,d<n} phi(n/d)*a(d). - _Sean A. Irvine_, Sep 27 2017
%p A007056 See A007055.
%o A007056 (Python)
%o A007056 from functools import lru_cache
%o A007056 from sympy import totient, proper_divisors
%o A007056 @lru_cache(maxsize=None)
%o A007056 def A007056(n): return (n*3**(1+(n>>1)) if n&1 else (n<<1)*3**(n>>1))-sum(totient(n//d)*A007056(d) for d in proper_divisors(n,generator=True)) if n else 1 # _Chai Wah Wu_, Feb 19 2024
%Y A007056 Column 3 of A284873.
%K A007056 nonn
%O A007056 0,2
%A A007056 _N. J. A. Sloane_, _Mira Bernstein_, R. Kemp
%E A007056 Entry revised by _N. J. A. Sloane_, Mar 07 2011