A338848 Number of compositions (ordered partitions) of n into distinct powers of 3.
1, 1, 0, 1, 2, 0, 0, 0, 0, 1, 2, 0, 2, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 2, 6, 0, 0, 0, 0, 2, 6, 0, 6, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 2, 6, 0, 0, 0, 0, 2, 6
Offset: 0
Keywords
Programs
-
PARI
a(n) = my(c=0,r); while(n, [n,r]=divrem(n,3); if(r==2,return(0)); c+=r); c!; \\ Kevin Ryde, Nov 14 2020