A276421 Number of palindromic compositions of n into nonprime numbers.
1, 1, 1, 1, 2, 1, 3, 1, 5, 3, 7, 4, 11, 6, 16, 9, 25, 14, 38, 21, 59, 34, 89, 50, 137, 77, 208, 117, 319, 180, 486, 273, 744, 420, 1134, 639, 1735, 977, 2648, 1491, 4048, 2281, 6180, 3480, 9444, 5321, 14421, 8122, 22035, 12412, 33655, 18957, 51417, 28966
Offset: 0
Keywords
Examples
a(6) = 3 because we have [6], [1,4,1], and [1,1,1,1,1,1]. a(10) = 7 because we have [10], [1,8,1], [1,1,6,1,1], [1,4,4,1], [4,1,1,4], [1,1,1,4,1,1,1], and [1^{10}].
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..10000
- V. E. Hoggatt, Jr., and Marjorie Bicknell, Palindromic compositions, Fibonacci Quart., Vol. 13(4), 1975, pp. 350-356.
Programs
-
Maple
F:=sum(z^j,j=1..229)-(sum(z^ithprime(k),k=1..50)): g:=(1+F)/(1-subs(z = z^2, F)): gser:=series(g,z=0,53): seq(coeff(gser,z,n),n=0..50); # second Maple program: a:= proc(n) option remember; `if`(isprime(n), 0, 1)+ add(`if`(isprime(j), 0, a(n-2*j)), j=1..n/2) end: seq(a(n), n=0..60); # Alois P. Heinz, Sep 03 2016
-
Mathematica
a[n_] := a[n] = If[PrimeQ[n], 0, 1] + Sum[If[PrimeQ[j], 0, a[n-2j]], {j, 1, n/2}]; Table[a[n], {n, 0, 60}] (* Jean-François Alcover, Feb 08 2017, after Alois P. Heinz *)
Formula
G.f.: g(z)=(1+F(z))/(1-F(z^2)), where F(z)=Sum_{m nonprime} z^m = z + z^4 + z^6 + z^8 + z^9 + z^10 + z^12 + ... is the g.f. of A005171.