login
A374369
Triangle T(n, k), n > 0, k = 0..n-1, read by rows; T(n, k) is the least m such that n and k differ modulo m.
2
2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 4, 2, 3, 2, 3, 2, 2, 4, 2, 3, 2, 3, 2, 3, 2, 4, 2, 3, 2, 3, 2, 2, 3, 2, 4, 2, 3, 2, 3, 2, 3, 2, 3, 2, 4, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 4, 2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 2, 4, 2, 3, 2, 3, 2, 2, 5, 2, 3, 2, 3, 2, 4, 2, 3, 2, 3, 2
OFFSET
1,1
FORMULA
T(n, k) = A007978(n-k).
EXAMPLE
Triangle T(n, k) begins:
n n-th row
-- ----------------------------------
1 2
2 3, 2
3 2, 3, 2
4 3, 2, 3, 2
5 2, 3, 2, 3, 2
6 4, 2, 3, 2, 3, 2
7 2, 4, 2, 3, 2, 3, 2
8 3, 2, 4, 2, 3, 2, 3, 2
9 2, 3, 2, 4, 2, 3, 2, 3, 2
10 3, 2, 3, 2, 4, 2, 3, 2, 3, 2
11 2, 3, 2, 3, 2, 4, 2, 3, 2, 3, 2
12 5, 2, 3, 2, 3, 2, 4, 2, 3, 2, 3, 2
MATHEMATICA
T[n_, k_]:=Module[{m=2}, While[Mod[n, m]==Mod[k, m], m++]; m]; Table[T[n, k], {n, 13}, {k, 0, n-1}]//Flatten (* Stefano Spezia, Jul 12 2024 *)
PROG
(PARI) T(n, k) = { for (m = 2, oo, if ((n%m) != (k%m), return (m); ); ); }
CROSSREFS
KEYWORD
nonn,easy,tabl
AUTHOR
Rémy Sigrist, Jul 06 2024
STATUS
approved