# Maple code for some sequences found in E. N. Gilbert and J. Riordan, # Symmetry types of periodic sequences, Illinois J. Math., 5 (1961), 657-665. Adn:=proc(d,n) local c,t1,t2; t2:=0; for c from 1 to d do if d mod c = 0 then t2:=t2 + (x^c/c)*(exp(c*z)-1); fi; od: t1:=exp(t2); t1:=series(t1,z,n+1); sort(n!*coeff(t1,z,n)); end; Pn:=proc(n) local d,e,t1; t1:=0; for d from 1 to n do if n mod d = 0 then t1:=t1 + phi(d)*Adn(d,n/d)/n; fi; od: t1/(1-x); end; Pnq:=proc(n,q) local t1; series(Pn(n),x,q+1); coeff(%,x,q); end; # Pnq(n,2) gives A000013 # Pnq(n,3) gives A002076 # Pnq(n,4) gives A056292 # Pnq(n,5) gives A056293 # Pnq(n,6) gives A056294 Qnq:=(n,q) -> Pnq(n,q)-Pnq(n,q-1); Qn:=proc(n) (1-x)*Pn(n); end; Reven:=proc(n) (Pn(n)+Adn(2,n/2)/(1-x))/2; end; Rodd :=proc(n) local np,j,t1; np:=(n-1)/2; Pn(n) + add(binomial(np,j)*Adn(2,j)*x/(1-x),j=0..np); end; # I was hoping to produce A000206, but so far this did not succeed