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.

A283419 a(n) is the multiplicative inverse of 3 modulo the n-th prime (or 0 if none exists).

Original entry on oeis.org

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

Views

Author

Jean-François Alcover, May 02 2017

Keywords

Examples

			3*5 mod prime(4) = 15 mod 7 = 1, so a(4) = 5.
		

Crossrefs

Cf. A006254 (modular inverses of 2 modulo the odd primes).

Programs

  • 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}]
  • PARI
    a(n) = if (n==2, 0, lift(1/Mod(3, prime(n)))); \\ Michel Marcus, Mar 31 2021

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

Extensions

Name edited and a(1)-a(2) prepended by Travis Scott, Feb 08 2023