login
A049765
Triangular array T, read by rows: T(n,k) = (k mod n) + (n mod k), for k = 1..n and n >= 1.
2
0, 1, 0, 1, 3, 0, 1, 2, 4, 0, 1, 3, 5, 5, 0, 1, 2, 3, 6, 6, 0, 1, 3, 4, 7, 7, 7, 0, 1, 2, 5, 4, 8, 8, 8, 0, 1, 3, 3, 5, 9, 9, 9, 9, 0, 1, 2, 4, 6, 5, 10, 10, 10, 10, 0, 1, 3, 5, 7, 6, 11, 11, 11, 11, 11, 0, 1, 2, 3, 4, 7, 6, 12, 12, 12, 12, 12, 0
OFFSET
1,5
EXAMPLE
Triangle T(n,k) (with rows n >= 1 and columns k >= 1) begins as follows:
0;
1, 0;
1, 3, 0;
1, 2, 4, 0;
1, 3, 5, 5, 0;
1, 2, 3, 6, 6, 0;
1, 3, 4, 7, 7, 7, 0;
1, 2, 5, 4, 8, 8, 8, 0;
1, 3, 3, 5, 9, 9, 9, 9, 0;
1, 2, 4, 6, 5, 10, 10, 10, 10, 0;
...
MAPLE
seq(seq( `mod`(k, n) + `mod`(n, k), k = 1..n), n = 1..15); # G. C. Greubel, Dec 13 2019
MATHEMATICA
Table[Mod[k, n] + Mod[n, k], {n, 15}, {k, n}]//Flatten (* G. C. Greubel, Dec 13 2019 *)
PROG
(PARI) T(n, k) = k%n + n%k;
for(n=1, 15, for(k=1, n, print1(T(n, k), ", "))) \\ G. C. Greubel, Dec 13 2019
(Magma) [[(k mod n) + (n mod k): k in [1..n]]: n in [1..15]]; // G. C. Greubel, Dec 13 2019
(Sage) [[(k%n) + (n%k) for k in (1..n)] for n in (1..15)] # G. C. Greubel, Dec 13 2019
(GAP) Flat(List([1..15], n-> List([1..n], k-> (k mod n) + (n mod k) ))); # G. C. Greubel, Dec 13 2019
CROSSREFS
Row sums are in A049766.
Sequence in context: A229654 A306288 A272188 * A343394 A194801 A361287
KEYWORD
nonn,tabl
STATUS
approved