OFFSET
1,3
COMMENTS
T(n,k) = smallest m such that k*m == 1 (mod prime(n)); prime(n) is the n-th prime: A000040(n).
LINKS
Franklin T. Adams-Watters, Table of n, a(n) for n = 1..4181 (primes less than 200)
Eric Weisstein's World of Mathematics, Modular Inverse
FORMULA
From Alexander Elkins (alexander_elkins(AT)hotmail.com), Mar 26 2010: (Start)
T(n, 1) = 1;
T(n, T(n,k)) = k;
T(n, prime(n)-1) = prime(n)-1. (End)
T(n,k) = k^(prime(n)-2) mod prime(n), with 1 <= k < prime(n). - Ridouane Oudra, Oct 04 2022
From Ammar Khatab, Nov 07 2024: (Start)
T(n,2) = (prime(n)+1)/2;
T(n,3) = (2*prime(n)+1)/3 + 2*prime(n)/(sqrt(3)*3) * sin(4*(prime(n)+2)/3 * Pi);
T(n,8) = (8*prime(n)+1)/8 - prime(n)/8 * (prime(n) mod 8);
T(n,prime(n)-k) = prime(n) - T(n,k);
T(n,prime(n)-2) = (prime(n)-1)/2 ;
T(n,prime(n)-3) = (prime(n)-1)/3 - 2*prime(n)/(sqrt(3)*3) * sin(4*(prime(n)+2)/3 * Pi);
T(n,prime(n)-8) = -1/8 + prime(n)/8 * (prime(n) mod 8). (End)
EXAMPLE
From Alexander Elkins (alexander_elkins(AT)hotmail.com), Mar 26 2010: (Start)
Table begins:
1;
1,2;
1,3,2,4;
1,4,5,2,3,6;
1,6,4,3,9,2,8,7,5,10;
1,7,9,10,8,11,2,5,3,4,6,12;
1,9,6,13,7,3,5,15,2,12,14,10,4,11,8,16;
1,10,13,5,4,16,11,12,17,2,7,8,3,15,14,6,9,18;
1,12,8,6,14,4,10,3,18,7,21,2,16,5,20,13,19,9,17,15,11,22;
... (End)
MAPLE
seq(seq(k^(ithprime(n)-2) mod ithprime(n), k=1..ithprime(n)-1), n=1..12); # Ridouane Oudra, Oct 04 2022
MATHEMATICA
Flatten[Table[PowerMod[n, -1, p], {p, Prime[Range[9]]}, {n, p-1}]] (* Alexander Elkins (alexander_elkins(AT)hotmail.com), Mar 26 2010 *)
T[n_, k_] := ModularInverse[k, Prime[n]]; Table[T[n, k], {n, 1, 9}, {k, 1, Prime[n]-1}] // Flatten (* Jean-François Alcover, May 08 2017 *)
PROG
(PARI) row(n) = my(p=prime(n)); vector(p-1, k, lift(1/Mod(k, prime(n)))); \\ Michel Marcus, Feb 24 2023
CROSSREFS
KEYWORD
nonn,tabf,changed
AUTHOR
Franklin T. Adams-Watters, Oct 20 2006
STATUS
approved