HP Forums

Full Version: modulo calculation: inverse of a number
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is it possible to have Prime calculate the inverse of a number mod(m)?
Example: the inverse of 3 mod 14 = 5
The class of x in Z/nZ is represented by x %% n, you can do arithmetic operations on these objects (including polynomials having them as coefficients).
a:=(3 %% 14)^-1
The class residue is represented with x between -n/2 and n/2.
Use %% 0 to extract the integer (for example a %% 0 will return 5 here).
Very interesting.

Also capable of finding square roots modulo, eg

SQRT(84%%(541*101)) = 24911

Nice.
Thank you very much, but I may recquire a little more help to that.
Maybe it's the bad lighting conditions in my study, but where do I find the %%?
I'm also new to CAS, so if this is CAS-stuff, then I can do with a pointer to some quick start guide on CAS as well.

Much appreciated.
In CAS environment actuate toolbox key, scroll to %, "enter, remove () from input line", repeat the operations in quotes & you have %%.
Easier probably - do SHIFT CHARS (the Vars key shift function) - and tap on the % sign, tap ECHO at the bottom of the screen twice, and then press ENTER. I probably should add % to the quick char menu on shift 9 too...


Side note - we will most likely by REMOVING the current %( ) function and replacing it with something like %PER( ) or similar in order to eliminate the need for the double %% thing for CAS modulo (name conflict). We'd wanted to do that in the beginning, but managers at the time heard that by doing it would "change a function from the 39g" and pretty much squashed it. No matter that all it does is divide the two numbers...

Anyway, this should be much nicer at some point in the future.
Thank you, Tim, much more efficient for %%.

Modulo calculations go very nicely on Prime, sadly I won't enjoy them too much,
50g more convenient & I quote Stephan P

"Maybe it's the bad lighting conditions in my study, but where do I find the %%?"

keyboard colouration prohibits my usage.
Reference URL's