login
A283419
a(n) is the multiplicative inverse of 3 modulo the n-th prime (or 0 if none exists).
0
1, 0, 2, 5, 4, 9, 6, 13, 8, 10, 21, 25, 14, 29, 16, 18, 20, 41, 45, 24, 49, 53, 28, 30, 65, 34, 69, 36, 73, 38, 85, 44, 46, 93, 50, 101, 105, 109, 56, 58, 60, 121, 64, 129, 66, 133, 141, 149, 76, 153, 78, 80, 161, 84, 86, 88, 90, 181, 185, 94, 189, 98, 205, 104, 209, 106, 221, 225
OFFSET
1,3
LINKS
Eric Weisstein's MathWorld, Modular Inverse
FORMULA
3 * a(n) == 1 (mod prime(n)).
a(n) = (p * (-1)^((r+1)/2))/3 mod p = q * (-1)^((r+1)/2) mod p where p = prime(n) = 3*q + r, with r = -1 or 1 and quotient q a positive integer. - Ian George Walker, Mar 24 2021
a(n) = ceiling(2p/3)/(p mod 3) where p is the n-th prime, a(2)=0. - Travis Scott, Feb 08 2023
EXAMPLE
3*5 mod prime(4) = 15 mod 7 = 1, so a(4) = 5.
MAPLE
a:= n-> `if`(n=2, 0, (p-> ceil(2*p/3)/(p mod 3))(ithprime(n))):
seq(a(n), n=1..75); # Alois P. Heinz, Feb 08 2023
MATHEMATICA
a[n_] := ModularInverse[3, Prime[n]]; Table[a[n], {n, 3, 100}]
Table[If[Mod[Prime@n, 3]==0, 0, ModularInverse[3, Prime@n]], {n, 88}]
PROG
(PARI) a(n) = if (n==2, 0, lift(1/Mod(3, prime(n)))); \\ Michel Marcus, Mar 31 2021
CROSSREFS
Cf. A006254 (modular inverses of 2 modulo the odd primes).
Sequence in context: A214533 A065221 A373053 * A114752 A204923 A123302
KEYWORD
nonn
AUTHOR
EXTENSIONS
Name edited and a(1)-a(2) prepended by Travis Scott, Feb 08 2023
STATUS
approved