|
|
A007056
|
|
Let S denote the palindromes in the language {0,1,2}*; a(n) = number of words of length n in the language SS.
(Formerly M2781)
|
|
5
|
|
|
1, 3, 9, 21, 57, 123, 279, 549, 1209, 2127, 4689, 7989, 17031, 28395, 60615, 98061, 208569, 334563, 705789, 1121877, 2356737, 3718827, 7786359, 12223077, 25488903, 39857523, 82876257, 129135729, 267784119, 416118219, 860825439, 1334448261, 2754778809, 4261609131, 8781196329, 13559714109, 27893530029
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
REFERENCES
|
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
|
|
LINKS
|
|
|
FORMULA
|
|
|
MAPLE
|
|
|
PROG
|
(Python)
from functools import lru_cache
from sympy import totient, proper_divisors
@lru_cache(maxsize=None)
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|