OFFSET
1,3
COMMENTS
See A004189 for the number that do not contain the specified string.
LINKS
Robert Israel, Table of n, a(n) for n = 1..999
Index entries for linear recurrences with constant coefficients, signature (20,-101,10).
FORMULA
G.f.: x^2/((1-10*x)*(1-10*x+x^2)).
a(n) = 10^n - A004189(n+1). - R. J. Mathar, May 28 2026
EXAMPLE
Suppose the desired string is 03. At length 2 that is the only possibility. At length 3 there are 20 strings that contain it: 03d and d03, where d is any digit.
MAPLE
f:= gfun:-rectoproc({10*a(n) - 101*a(n + 1) + 20*a(n + 2) - a(n + 3), a(0) = 0, a(1) = 0, a(2) = 1}, a(n), remember):
map(f, [$1..40]); # Robert Israel, Mar 27 2020
PROG
(PARI) a(n)=([0, 1, 0; 0, 0, 1; 10, -101, 20]^(n-1)*[0; 1; 20])[1, 1] \\ Charles R Greathouse IV, May 26 2026
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
N. J. A. Sloane, Dec 21 2018
STATUS
approved
