Ramanujan's Lost Notebook Part II, Ch. 12: ch12Inverse
DefinitionRamanujanLostNotebook_PartII_ch12_ch12Inversenumber-theoryramanujan-lost-notebook
For a representative c>d>0, the unique a in [0,c) satisfying ad≡1 mod c. The finite sum selects that inverse; values off the representative locus are irrelevant to W. This avoids carrying arbitrary Bezout choices as hypotheses.
Definition code
import Mathlib namespace RamanujanLostNotebook.PartII /-- For a representative c>d>0, the unique a in [0,c) satisfying ad≡1 mod c. The finite sum selects that inverse; values off the representative locus are irrelevant to W. This avoids carrying arbitrary Bezout choices as hypotheses. -/ def ch12Inverse (c d : ℕ) : ℕ := ∑ a ∈ Finset.range c, if (a * d) % c = 1 then a else 0 end RamanujanLostNotebook.PartII
Source
G. E. Andrews and B. C. Berndt, Ramanujan's Lost Notebook, Part II, Springer 2009, Chapter 12.