modulo calculation: inverse of a number
|
02-11-2016, 12:32 PM
Post: #1
|
|||
|
|||
modulo calculation: inverse of a number
Is it possible to have Prime calculate the inverse of a number mod(m)?
Example: the inverse of 3 mod 14 = 5 |
|||
02-11-2016, 05:24 PM
Post: #2
|
|||
|
|||
RE: modulo calculation: inverse of a number
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). |
|||
02-11-2016, 06:21 PM
Post: #3
|
|||
|
|||
RE: modulo calculation: inverse of a number
Very interesting.
Also capable of finding square roots modulo, eg SQRT(84%%(541*101)) = 24911 Nice. |
|||
02-11-2016, 07:09 PM
Post: #4
|
|||
|
|||
RE: modulo calculation: inverse of a number
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. |
|||
02-11-2016, 07:52 PM
(This post was last modified: 02-11-2016 07:54 PM by Gerald H.)
Post: #5
|
|||
|
|||
RE: modulo calculation: inverse of a number
In CAS environment actuate toolbox key, scroll to %, "enter, remove () from input line", repeat the operations in quotes & you have %%.
|
|||
02-11-2016, 08:09 PM
Post: #6
|
|||
|
|||
RE: modulo calculation: inverse of a number
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. TW Although I work for HP, the views and opinions I post here are my own. |
|||
02-11-2016, 08:26 PM
Post: #7
|
|||
|
|||
RE: modulo calculation: inverse of a number
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. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)