|
Search: id:A061865
|
|
|
| A061865 |
|
Triangle where the k-th item at n-th row (both starting from 1) tells in how many ways we can add k distinct integers from 1 to n, in such way that the sum is divisible by k. |
|
+0 3
|
|
| 1, 2, 0, 3, 1, 1, 4, 2, 2, 0, 5, 4, 4, 1, 1, 6, 6, 8, 4, 2, 0, 7, 9, 13, 9, 5, 1, 1, 8, 12, 20, 18, 12, 4, 2, 0, 9, 16, 30, 32, 26, 14, 6, 1, 1, 10, 20, 42, 54, 52, 34, 18, 6, 2, 0, 11, 25, 57, 84, 94, 76, 48, 21, 7, 1, 1, 12, 30, 76, 126, 160, 152, 114, 64, 26, 6, 2, 0, 13, 36, 98
(list; table; graph; listen)
|
|
|
OFFSET
|
0,2
|
|
|
LINKS
|
Index entries for sequences related to subset sums modulo m
|
|
EXAMPLE
|
The third term of the sixth row is 8 because we have solutions {1+2+3, 1+2+6, 1+3+5, 1+5+6, 2+3+4, 2+4+6, 3+4+5, 4+5+6} which all are divisible by 3.
|
|
MAPLE
|
[seq(DivSumChooseTriangle(j), j=1..120)]; DivSumChooseTriangle := (n) -> nops(DivSumChoose(trinv(n-1), (n-((trinv(n-1)*(trinv(n-1)-1))/2))));
DIVSum_SOLUTIONS_GLOBAL := []; DivSumChoose := proc(n, k) global DIVSum_SOLUTIONS_GLOBAL; DIVSum_SOLUTIONS_GLOBAL := []; DivSumChooseSearch([], n, k); RETURN(DIVSum_SOLUTIONS_GLOBAL); end;
DivSumChooseSearch := proc(s, n, k) global DIVSum_SOLUTIONS_GLOBAL; local i, p; p := nops(s); if(p = k) then if(0 = (convert(s, `+`) mod k)) then DIVSum_SOLUTIONS_GLOBAL := [op(DIVSum_SOLUTIONS_GLOBAL), s]; fi; else for i from lmax(s)+1 to n-(k-p)+1 do DivSumChooseSearch([op(s), i], n, k); od; fi; end;
lmax := proc(a) local e, z; z := 0; for e in a do if whattype(e) = list then e := last_term(e); fi; if e > z then z := e; fi; od; RETURN(z); end;
|
|
CROSSREFS
|
The second diagonal is given by C(((n+(n mod 2))/2), 2)+C(((n-(n mod 2))/2), 2) = A002620, the third diagonal by A061866. Cf. A061857.
Sequence in context: A124754 A047983 A070812 this_sequence A135818 A078804 A071465
Adjacent sequences: A061862 A061863 A061864 this_sequence A061866 A061867 A061868
|
|
KEYWORD
|
nonn,tabl
|
|
AUTHOR
|
Antti Karttunen May 11 2001
|
|
|
Search completed in 0.002 seconds
|