A082267 Number of palindromes that use nonzero digits and have a digit sum of n.
1, 2, 2, 4, 4, 8, 8, 16, 16, 31, 31, 62, 62, 124, 124, 248, 248, 496, 496, 991, 991, 1980, 1980, 3956, 3956, 7904, 7904, 15792, 15792, 31553, 31553, 63044, 63044, 125964, 125964, 251680, 251680, 502864, 502864, 1004737, 1004737, 2007494, 2007494
Offset: 1
Links
- G. C. Greubel, Table of n, a(n) for n = 1..1000
Programs
-
Maple
seq(coeff(series(x*(1+2*x-x^9-x^10-x^19)/(1-2*x^2+x^20),x,n+1), x, n), n = 1 .. 42); # Muniru A Asiru, Dec 08 2018
Formula
a(1) = 1, a(2) = 2. For 2
Further remarks from Jonathan R. Love (japanada11(AT)yahoo.ca), Mar 08 2007: (Start) For 2
For n=10 or 11: Using the rules for 2
For 12
For 20: Including the terms subtracted in 12
For 21<=n: From this point on, all possible terms are 9(a(n-18))9 + 8(a(n-16))8 + 7(a(n-14))7 + 6(a(n-12))6 + 5(a(n-10))5 + 4(a(n-8))4 + 3(a(n-6))3 + 2(a(n-4))2 + 1(a(n-2))1. If a(n-20) were to be included, it would need to be (10)(a(n-20))(10) and 10s can't be included. So everything must subtract a(n-20) from the total of 2 * a(n-2). For example, a(24) = 3956 = 2 * a(22) - a(4). (End)
Let c(n,k) (1<=k<=n) = number of compositions of n into parts of size <= k (cf. A126198). Then a(n) = Sum_{i=0..floor(n/2)} c(n,9). This follows by consideration of the central term, which may be any of n, n-2, n-4, ..., n-2i, ...; the prefix is then a composition of i into parts of size <= 9. - N. J. A. Sloane Mar 09 2007
From Colin Barker, Feb 14 2013: (Start)
a(n) = 2*a(n-2) - a(n-20) for n > 20.
G.f.: x*(1+2*x-x^9-x^10-x^19) / (1-2*x^2+x^20). (End)
Extensions
Corrected and extended by Jonathan R. Love, Mar 08 2007
Comments