A267632 Triangle T(n, k) read by rows: the k-th column of the n-th row lists the number of ways to select k distinct numbers (k >= 1) from [1..n] so that their sum is divisible by n.
1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 2, 2, 1, 1, 1, 2, 4, 3, 1, 0, 1, 3, 5, 5, 3, 1, 1, 1, 3, 7, 9, 7, 3, 1, 0, 1, 4, 10, 14, 14, 10, 4, 1, 1, 1, 4, 12, 22, 26, 20, 12, 5, 1, 0, 1, 5, 15, 30, 42, 42, 30, 15, 5, 1, 1, 1, 5, 19, 42, 66, 76, 66, 43, 19, 5, 1, 0
Offset: 1
Examples
For n = 5, there is one way to pick one number (5), two ways to pick two numbers (1+4, 2+3), two ways to pick 3 numbers (1+4+5, 2+3+5), one way to pick 4 numbers (1+2+3+4), and one way to pick 5 numbers (1+2+3+4+5) so that their sum is divisible by 5. Therefore, T(5,1) = 1, T(5,2) = 2, T(5,3) = 2, T(5,4) = 1, and T(5,5) = 1. Table for T(n,k) begins as follows: n\k 1 2 3 4 5 6 7 8 9 10 1 1 2 1 0 3 1 1 1 4 1 1 1 0 5 1 2 2 1 1 6 1 2 4 3 1 0 7 1 3 5 5 3 1 1 8 1 3 7 9 7 3 1 0 9 1 4 10 14 14 10 4 1 1 10 1 4 12 22 26 20 12 5 1 0 ...
Links
- Alois P. Heinz, Rows n = 1..150, flattened
- Eric Stephen Barnes, The construction of perfect and extreme forms I, Acta Arith., 5 (1959); see pp. 65-66.
- Michiel Kosters, The subset sum problem for finite abelian groups, J. Combin. Theory Ser. A 120 (2013), 527-530.
- Jiyou Li and Daqing Wan, Counting subset sums of finite abelian groups, J. Combin. Theory Ser. A 119 (2012), 170-182; see pp. 171-172.
- K. G. Ramanathan, Some applications of Ramanujan's trigonometrical sum C_m(n), Proc. Indian Acad. Sci., Sect. A 20 (1944), 62-69; see p. 66.
- R. D. von Sterneck, Ein Analogon zur additiven Zahlentheorie, Sitzungsber. Akad. Wiss. Sapientiae Math.-Naturwiss. Kl. 111 (1902), 1567-1601 (Abt. IIa).
- R. D. von Sterneck, Über ein Analogon zur additiven Zahlentheorie, Jahresbericht der Deutschen Mathematiker-Vereinigung 12 (1903), 110-113.
Crossrefs
Programs
-
Maple
A267632 := proc(n,k) local a,msel,p; a := 0 ; for msel in combinat[choose](n,k) do if modp(add(p,p=msel),n) = 0 then a := a+1 ; end if; end do: a; end proc: # R. J. Mathar, May 15 2016 # second Maple program: b:= proc(n, m, s) option remember; expand(`if`(n=0, `if`(s=0, 1, 0), b(n-1, m, s)+x*b(n-1, m, irem(s+n, m)))) end: T:= n-> (p-> seq(coeff(p, x, i), i=1..n))(b(n$2, 0)): seq(T(n), n=1..14); # Alois P. Heinz, Aug 27 2018
-
Mathematica
f[k_, n_] := Length[Select[Select[Subsets[Range[n]], Length[#] == k &], IntegerQ[Total[#]/n] &]];MatrixForm[Table[{n, Table[f[k, n], {k, n}]}, {n, 10}]] (* Dimitri Papadopoulos, Jan 18 2016 *)
Formula
From Petros Hadjicostas, Jul 13 2019: (Start)
T(n, k) = (1/n) * Sum_{s | gcd(n, k)} (-1)^(k - (k/s)) * phi(s) * binomial(n/s, k/s) for 1 <= k <= n.
G.f. for column k >= 1: (x^k/k) * Sum_{s|k} phi(s) * (-1)^(k - (k/s)) / (1 - x^s)^(k/s).
Bivariate g.f.: Sum_{n, k >= 1} T(n, k)*x^n*y^k = -x/(1 - x) - Sum_{s >= 1} (phi(s)/s) * log(1 - x^s + (-x*y)^s).
(End)
Sum_{k=1..n} k * T(n,k) = A309122(n). - Alois P. Heinz, Jul 13 2019
Comments