OFFSET
0,3
COMMENTS
If n = 2^k, a(n) = A003095(k). Otherwise, a(n) is the product of terms from A003095 corresponding to the powers of two in the binary representation of n. If n is odd, the final term of the composition must be 1, so a(n) = a(n-1).
Pieter Mostert points out that, after the first two values, this is a subsequence of A000404 (sums of two nonzero squares), because each term is either a square + 1 or a product of two earlier terms.
FORMULA
Let p be the largest power of two less than n; then a(n) = a(p)a(n-p) if n is not a power of two, or a(n) = a(p)^2 + 1 if n is a power of two.
EXAMPLE
For n = 4 the a(4) = 5 compositions are 1+1+1+1, 1+1+2, 2+1+1, 2+2, and 4. The composition 1+2+1 is not allowed, because 2 does not divide the sum of previous terms.
CROSSREFS
KEYWORD
nonn
AUTHOR
David Eppstein, Aug 17 2024
STATUS
approved