cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A220691 Table A(i,j) read by antidiagonals in order A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), ..., where A(i,j) is the number of ways in which we can add 2 distinct integers from the range 1..i in such a way that the sum is divisible by j.

This page as a plain text file.
%I A220691 #23 Jun 12 2021 23:33:02
%S A220691 0,0,1,0,0,3,0,1,1,6,0,0,1,2,10,0,0,1,2,4,15,0,0,1,1,4,6,21,0,0,0,2,2,
%T A220691 5,9,28,0,0,0,1,2,3,7,12,36,0,0,0,1,2,3,5,10,16,45,0,0,0,0,2,2,4,6,12,
%U A220691 20,55,0,0,0,0,1,3,3,6,8,15,25,66,0,0,0,0
%N A220691 Table A(i,j) read by antidiagonals in order A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), ..., where A(i,j) is the number of ways in which we can add 2 distinct integers from the range 1..i in such a way that the sum is divisible by j.
%H A220691 A. Karttunen, <a href="/A220691/b220691.txt">The first 150 antidiagonals of the square array, flattened</a>
%H A220691 Stackexchange, <a href="http://math.stackexchange.com/questions/142323/sequence-generation/142364">Question 142323</a>
%H A220691 <a href="/index/Su#subsetsums">Index entries for sequences related to subset sums modulo m</a>
%F A220691 See _Robert Israel_'s formula at A061857.
%e A220691 The upper left corner of this square array starts as:
%e A220691    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
%e A220691    1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, ...
%e A220691    3, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, ...
%e A220691    6, 2, 2, 1, 2, 1, 1, 0, 0, 0, 0, ...
%e A220691   10, 4, 4, 2, 2, 2, 2, 1, 1, 0, 0, ...
%e A220691   15, 6, 5, 3, 3, 2, 3, 2, 2, 1, 1, ...
%e A220691 Row 1 is all zeros, because it's impossible to choose two distinct integers from range [1]. A(2,1) = 1, as there is only one possibility to choose a pair of distinct numbers from the range [1,2] such that it is divisible by 1, namely 1+2. Also A(2,3) = 1, as 1+2 is divisible by 3.
%e A220691 A(4,1) = 2, as from [1,2,3,4] one can choose two pairs of distinct numbers whose sum is even: {1+3} and {2+4}.
%t A220691 a[n_, 1] := n*(n-1)/2; a[n_, k_] := Module[{r}, r = Reduce[1 <= i < j <= n && Mod[i + j, k] == 0, {i, j}, Integers]; Which[Head[r] === Or, Length[r], Head[r] === And, 1, r === False, 0, True, Print[r, " not parsed"]]]; Table[a[n-k+1, k], {n, 1, 13} , {k, n, 1, -1}] // Flatten (* _Jean-François Alcover_, Mar 04 2014 *)
%o A220691 (Scheme function, written after _Robert Israel_'s formula given at A061857):
%o A220691 (define (A220691 n) (A220691bi (A002260 n) (A004736 n)))
%o A220691 (define (A220691bi n k) (let* ((b (modulo (+ 1 n) k)) (q (/ (- (+ 1 n) b) k)) (c (modulo k 2))) (cond ((< b 2) (+ (* q q k (/ 1 2)) (* q b) (* -2 q) (* -1 b) 1 (* c q (/ 1 2)))) ((>= b (/ (+ k 3) 2)) (+ (* q q k (/ 1 2)) (* q b) (* -2 q) b -1 (* (/ k -2)) (* c (+ 1 q) (/ 1 2)))) (else (+ (* q q k (/ 1 2)) (* q b) (* -2 q) (* c q (/ 1 2)))))))
%Y A220691 Transpose: A220692. The lower triangular region of this square array is given by A061857, which leaves out about half of the nonzero terms. A220693 is another variant giving 2n-1 terms from the beginning of each row, thus containing all the nonzero terms of this array.
%Y A220691 The left column of the table: A000217. The following cases should be checked: the second column: A002620, the third column: A058212 (after the first two terms), the fourth column: A001971.
%K A220691 nonn,tabl
%O A220691 1,6
%A A220691 _Antti Karttunen_, Feb 18 2013