APL(NARS), 89 chars
r←l w;b;e;n (b e n)←w⋄r←1 →3×⍳0=2∣e⋄r←n∣r×b b←n∣b×b⋄→2×⍳0<e←⌊e÷2 f←{l ⍺,(¯1+2x*⍵-1),2x*⍵} //12+14+18+21+24=89
I follow what some other have said that x^-1=x^((2^n2^(n-1))-1)%n. For calculate that it, in my way of see there is need the ltor or powmod function, that here would be the function l.
f has need 2 arguments, in alpha the number for find the inverse, in omega the n. Return 0 if not exist inverse, otherwise return a integer positive. Not existe one inverse of all even numbers.
5 f 100 1014120480182583521197362564301 (2x*100)∣5×5 f 100 1 4 f 100 0 (2x*100)∣99×99 f 100 1 99 f 100 409745648558619604524186894667