OFFSET
0,2
REFERENCES
H. S. Wilf, The Editor's Corner: Strings, Substrings, and the `Nearest Integer' Function, Amer. Math. Monthly 94 (1987), 855-860.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 0..706
Index entries for linear recurrences with constant coefficients, signature (26, 0, -1).
FORMULA
a(0)=1, a(1)=26, a(2) = 26^2; thereafter, a(n) = 26*a(n-1) - a(n-3).
EXAMPLE
At length 3, only one word (CAT) is excluded, so a(3) = 26^3 - 1 = 17575.
MAPLE
f:=proc(n, A) option remember;
if n<0 then 0 elif n=0 then 1 else A*f(n-1, A) - f(n-3, A); fi;
end;
[seq(f(n, 26), n=0..25)];
MATHEMATICA
f[n_, A_] := f[n, A] = Which[n < 0, 0, n == 0, 1, True, A*f[n-1, A] - f[n-3, A]];
Table[f[n, 26], {n, 0, 25}] (* Jean-François Alcover, Apr 14 2023, after Maple code *)
LinearRecurrence[{26, 0, -1}, {1, 26, 26^2}, 20] (* Harvey P. Dale, Dec 02 2023 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Feb 24 2023
STATUS
approved