Post Reply 
Solving a Single Congruence Equation
04-15-2014, 01:48 PM
Post: #4
RE: Solving a Single Congruence Equation
(04-12-2014 11:00 PM)rprosperi Wrote:  Returns answer of 2 instantly on an actual Prime. I guess faster than instantly on the emulator.

Is that the answer to: 999999999998 * x = 1 mod 999999999999 ?

Because that's wrong. 999999999998 * 2 = 999999999997 mod 999999999999
But that's probably due to a rounding error:

\(\frac{999999999998 \times 2 - 1}{999999999999} = 1.9999999999969999999999969999999999969999999999969999...\)

This will be rounded to 2.00000000000.

The correct answer is of course: x = 999999999998 = -1 mod 999999999999

The 2nd example shouldn't suffer from these kind of problems though I didn't test it.

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Solving a Single Congruence Equation - Thomas Klemm - 04-15-2014 01:48 PM



User(s) browsing this thread: 1 Guest(s)