OFFSET
0,3
COMMENTS
Every sequence can be uniquely split into a sequence of non-overlapping runs. For example, the runs of (2,2,1,1,1,3,2,2) are ((2,2),(1,1,1),(3),(2,2)), with sums (4,3,3,4).
LINKS
David A. Corneth, Table of n, a(n) for n = 0..10000
FORMULA
From David A. Corneth, Jun 02 2022 (Start)
a(p) = 2 for prime p.
a(p*q) = 8 for distinct primes p and q (Cf. A006881).
a(n) = Sum_{d|n} tau(d)*(tau(d)-1) ^ (n/d - 1) where tau = A000005. (End)
EXAMPLE
The a(0) = 1 through a(8) = 12 compositions:
() (1) (2) (3) (4) (5) (6) (7) (8)
(11) (111) (22) (11111) (33) (1111111) (44)
(112) (222) (224)
(211) (1113) (422)
(1111) (2112) (2222)
(3111) (11114)
(11211) (41111)
(111111) (111122)
(112112)
(211211)
(221111)
(11111111)
For example:
(1,1,2,1,1) has run-sums (2,2,2) so is counted under a(6).
(4,1,1,1,1,2,2) has run-sums (4,4,4) so is counted under a(12).
(3,3,2,2,2) has run-sums (6,6) so is counted under a(12).
MATHEMATICA
Table[Length[Select[Join@@Permutations/@ IntegerPartitions[n], SameQ@@Total/@Split[#]&]], {n, 0, 15}]
PROG
(PARI) a(n) = {if(n <=1, return(1)); my(d = divisors(n), res = 0); for(i = 1, #d, nd = numdiv(d[i]); res+=(nd*(nd-1)^(n/d[i]-1)) ); res } \\ David A. Corneth, Jun 02 2022
CROSSREFS
The version for parts or runs instead of run-sums is A000005.
The version for multiplicities instead of run-sums is A098504.
All parts are divisors of n, see A100346.
These compositions are ranked by A353848.
The distinct instead of equal version is A353850.
A005811 counts runs in binary expansion.
A011782 counts compositions.
A353847 represents the composition run-sum transformation.
For distinct instead of equal run-sums: A032020, A098859, A242882, A329739, A351013, A353837, ranked by A353838 (complement A353839), A353852, A354580, ranked by A354581.
KEYWORD
nonn,easy
AUTHOR
Gus Wiseman, May 31 2022
EXTENSIONS
More terms from David A. Corneth, Jun 02 2022
STATUS
approved