login
Table T(n,k) = reciprocal of k modulo prime(n), for 1 <= k < prime(n).
5

%I #32 Feb 24 2023 12:28:38

%S 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,

%T 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,

%U 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

%N Table T(n,k) = reciprocal of k modulo prime(n), for 1 <= k < prime(n).

%C T(n,k) = smallest m such that k*m == 1 (mod prime(n)); prime(n) is the n-th prime: A000040(n).

%H Franklin T. Adams-Watters, <a href="/A124223/b124223.txt">Table of n, a(n) for n = 1..4181 (primes less than 200)</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/ModularInverse.html">Modular Inverse</a>

%F From Alexander Elkins (alexander_elkins(AT)hotmail.com), Mar 26 2010: (Start)

%F T(n, 1) = 1;

%F T(n, T(n,k)) = k;

%F T(n, prime(n)-1) = prime(n)-1. (End)

%F T(n,k) = k^(prime(n)-2) mod prime(n), with 1 <= k < prime(n). - _Ridouane Oudra_, Oct 04 2022

%e From Alexander Elkins (alexander_elkins(AT)hotmail.com), Mar 26 2010: (Start)

%e Table begins:

%e 1;

%e 1,2;

%e 1,3,2,4;

%e 1,4,5,2,3,6;

%e 1,6,4,3,9,2,8,7,5,10;

%e 1,7,9,10,8,11,2,5,3,4,6,12;

%e 1,9,6,13,7,3,5,15,2,12,14,10,4,11,8,16;

%e 1,10,13,5,4,16,11,12,17,2,7,8,3,15,14,6,9,18;

%e 1,12,8,6,14,4,10,3,18,7,21,2,16,5,20,13,19,9,17,15,11,22;

%e ... (End)

%p seq(seq(k^(ithprime(n)-2) mod ithprime(n), k=1..ithprime(n)-1), n=1..12); # _Ridouane Oudra_, Oct 04 2022

%t Flatten[Table[PowerMod[n,-1,p],{p,Prime[Range[9]]},{n,p-1}]] (* Alexander Elkins (alexander_elkins(AT)hotmail.com), Mar 26 2010 *)

%t 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 *)

%o (PARI) row(n) = my(p=prime(n)); vector(p-1, k, lift(1/Mod(k, prime(n)))); \\ _Michel Marcus_, Feb 24 2023

%Y Cf. A124224, A102057, A000040, A006093 (row lengths).

%K nonn,tabf

%O 1,3

%A _Franklin T. Adams-Watters_, Oct 20 2006