inverse of 985 mod(φ60131) Alright Ive been working on this one for a while 
I found φ(60131) to be 97294

½(60131+60131(5)^.5) = 97294


then I worked through the GCD

GCD(985,97294) = 1
97294 = 985*98+764
985=764*1+221
764 = 221*3+101
221 = 101*2+19
101=19*5+6
19= 6*3+1
6 = 1*6     GCD = 1


Now Im stuck trying to find the inverse of 985 mod φ(60131)
this is the work I have

19 – (6*3) = 1 --&gt; 19 – (101 – (19*5))*3 = 1
19*15 - 284 = 1 --&gt; (221 – (101*2))*15 – 284 = 1
-101*30+3031=1 --&gt; -(764-(221*3))*30+3031 = 1
221*90-19889 --&gt; (985 - 764)*90-19889=1
-764*90+68761=1 --&gt; -(97294-(985*98))*90+68761=1
985*8820-8687699=1


I was expecting 8687699 to be divisible by 97294 what went wrong?
I think you may have calculated φ(60131) incorrectly.

60131 has two prime factors: 157, 383
Therefore: φ(60131) = (157-1) * (383-1) = 59592

GCD(985,59592) = 1
59592 =  60 * 985 + 492
  985 =   2 * 492 + 1
  492 = 492 * 1


So to determine the inverse of 985 mod φ(60131):

1 = 985 - 2 * 492
1 = 985 - 2 * (59592 - 60 * 985)
1 = 985 - 2 * 59592 + 120 * 985
1 = 121 * 985 - 2 * 59592


Therefore 121 is the inverse of 985 mod φ(60131).