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.

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.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Jun 29 2017

Keywords

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.

Examples

			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
		

Crossrefs

Programs

  • 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 *)
  • PARI
    T(n, k) = if (gcd(n, k)==1, lift(1/Mod(k, n)), k)