A122585 Reciprocal of n modulo smallest prime greater than n.
1, 2, 2, 4, 3, 6, 8, 7, 5, 10, 6, 12, 4, 11, 8, 16, 9, 18, 17, 15, 11, 22, 24, 23, 7, 19, 14, 28, 15, 30, 6, 22, 9, 12, 18, 36, 10, 27, 20, 40, 21, 42, 35, 31, 23, 46, 44, 21, 13, 35, 26, 52, 49, 47, 44, 39, 29, 58, 30, 60, 11, 40, 50, 22, 33, 66, 53, 47, 35, 70, 36, 72, 13, 63, 59
Offset: 1
Keywords
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
Programs
-
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 *)
-
Python
from sympy import nextprime def A122585(n): return pow(n,-1,nextprime(n)) # Chai Wah Wu, Apr 13 2023
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)