OFFSET
1,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..1000
FORMULA
Conjecture: a(n) = (n + 1) * A063776(n)/4 - (phi(n)/2) * (1 + (-1)^n)/2 = ((n + 1)/(4*n)) * A053636(n) - (phi(n)/2) * (1 + (-1)^n)/2. - Petros Hadjicostas, Jul 20 2019
a(n) = A309280(n,n). - Alois P. Heinz, Jul 21 2019
EXAMPLE
The subsets of [5] whose sum is divisible by 5 are: {}, {5}, {1,4}, {2,3}, {1,4,5}, {2,3,5}, {1,2,3,4}, {1,2,3,4,5}. The sum of their elements is 0 + 5 + 5 + 5 + 10 + 10 + 10 + 15 = 60. So a(5) = 60/5 = 12.
MAPLE
b:= proc(n, m, s) option remember; `if`(n=0, [`if`(s=0, 1, 0), 0],
b(n-1, m, s) +(g-> g+[0, g[1]*n])(b(n-1, m, irem(s+n, m))))
end:
a:= proc(n) option remember; forget(b); b(n$2, 0)[2]/n end:
seq(a(n), n=1..40);
MATHEMATICA
b[n_, m_, s_] := b[n, m, s] = If[n == 0, {If[s == 0, 1, 0], 0},
b[n-1, m, s] + Function[g, g+{0, g[[1]] n}][b[n-1, m, Mod[s+n, m]]]];
a[n_] := b[n, n, 0][[2]]/n;
Table[a[n], {n, 1, 40}] (* Jean-François Alcover, Mar 19 2022, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jul 13 2019
STATUS
approved