A255485 Number of odd terms in expansion of (1 + x + x^2 + x^4)^n.
1, 4, 4, 8, 4, 12, 8, 14, 4, 16, 12, 24, 8, 24, 14, 30, 4, 16, 16, 32, 12, 36, 24, 44, 8, 32, 24, 48, 14, 46, 30, 60, 4, 16, 16, 32, 16, 48, 32, 56, 12, 48, 36, 72, 24, 76, 44, 92, 8, 32, 32, 64, 24, 72, 48, 88, 14, 56, 46, 92, 30, 96, 60, 118, 4, 16, 16, 32, 16, 48, 32, 56, 16, 64, 48, 96
Offset: 0
Links
- Robert Israel, Table of n, a(n) for n = 0..10000
Programs
-
Maple
r1:=proc(f) local g,n; g:=n->nops(expand(f^n) mod 2); [seq(g(n),n=0..90)]; end; r1(1+x+x^2+x^4); # Alternative: P:= 1: for n from 0 to 100 do A[n]:= nops(P); P:= expand(P*(1+x+x^2+x^4)) mod 2; od: seq(A[i],i=0..100); # Robert Israel, Jan 07 2018
-
Mathematica
a[n_] := Count[(List @@ Expand[(1+x+x^2+x^4)^n]) /. x -> 1, _?OddQ]; a[0] = 1; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Feb 06 2023 *)
-
PARI
a(n) = {my(pol=(1+x+x^2+x^4)*Mod(1,2)); subst(lift(pol^n), x, 1);} \\ Michel Marcus, Mar 01 2015