login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A289251
Triangle T(n, k), n > 0 and 0 <= k < n, read by rows; if gcd(n, k) = 1, then T(n, k) = modular inverse of k (mod n), otherwise T(n, k) = k.
1
0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 1, 3, 2, 4, 0, 1, 2, 3, 4, 5, 0, 1, 4, 5, 2, 3, 6, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 5, 3, 7, 2, 6, 4, 8, 0, 1, 2, 7, 4, 5, 6, 3, 8, 9, 0, 1, 6, 4, 3, 9, 2, 8, 7, 5, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 7, 9, 10, 8, 11
OFFSET
1,6
COMMENTS
The n-th row has n terms, and is a self-inverse permutation of the first n nonnegative numbers.
T(n, 0) = 0 for any n > 0.
T(n, 1) = 1 for any n > 1.
T(n, n-1) = n-1 for any n > 0.
If n > 0 and gcd(n, k) = 1 then T(n, k) = A102057(n, k).
T(prime(n), k) = A124223(n, k) for any n > 0 and k in 1..prime(n)-1.
EXAMPLE
The first rows are:
n\k 0 1 2 3 4 5 6 7 8 9
1 0
2 0 1
3 0 1 2
4 0 1 2 3
5 0 1 3 2 4
6 0 1 2 3 4 5
7 0 1 4 5 2 3 6
8 0 1 2 3 4 5 6 7
9 0 1 5 3 7 2 6 4 8
10 0 1 2 7 4 5 6 3 8 9
MATHEMATICA
T[n_, k_] := If[GCD[n, k] == 1, PowerMod[k, -1, n], k];
Table[T[n, k], {n, 1, 13}, {k, 0, n-1}] // Flatten (* Jean-François Alcover, Oct 31 2017 *)
PROG
(PARI) T(n, k) = if (gcd(n, k)==1, lift(1/Mod(k, n)), k)
CROSSREFS
Sequence in context: A099173 A293377 A159880 * A353174 A233292 A108456
KEYWORD
nonn,tabl
AUTHOR
Rémy Sigrist, Jun 29 2017
STATUS
approved