OFFSET
1,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000 (first 1000 terms from Harvey P. Dale)
Eric Weisstein's World of Mathematics, Modular Inverse
FORMULA
From Alois P. Heinz, Apr 13 2023: (Start)
a(n) = n <=> n in { A006093 }.
a(n) = (n+1)/2 <=> n in { A040976 } \ { 0 }. (End)
MAPLE
a:= n-> n&^(-1) mod nextprime(n):
seq(a(n), n=1..100); # Alois P. Heinz, Apr 13 2023
MATHEMATICA
Table[PowerMod[n, -1, NextPrime[n]], {n, 80}] (* Harvey P. Dale, Apr 13 2023 *)
PROG
(Python)
from sympy import nextprime
def A122585(n): return pow(n, -1, nextprime(n)) # Chai Wah Wu, Apr 13 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Franklin T. Adams-Watters, Oct 20 2006
STATUS
approved