HP-50g Modular Arithmetic
|
02-06-2019, 07:15 PM
Post: #1
|
|||
|
|||
HP-50g Modular Arithmetic
Could someone help me understand how the Modulo functions work on the HP-50g
|
|||
02-06-2019, 09:26 PM
Post: #2
|
|||
|
|||
RE: HP-50g Modular Arithmetic
Any concrete use case?
In general see the 50g advanced user reference pdf . Page 3-150 If you put x on level2 and y on level1 and then you use MOD you get: x mod y. Wikis are great, Contribute :) |
|||
02-07-2019, 05:21 AM
(This post was last modified: 02-07-2019 05:22 AM by Gerald H.)
Post: #3
|
|||
|
|||
RE: HP-50g Modular Arithmetic
pier4r's reference gives this information:
Code: Modulo Function: Returns a remainder defined by: x mod y = x – y floor (x/y) Just in case you don't have the Advanced manual. AURM is available here: https://www.hpcalc.org/details/7141 |
|||
02-07-2019, 08:22 AM
Post: #4
|
|||
|
|||
RE: HP-50g Modular Arithmetic
Arithmetic Modulo commands
ADDTMOD ........................... 3-9 DIVMOD ........................... 3-63 DIV2MOD .......................... 3-62 EXPANDMOD ........................ 3-80 FACTORMOD ........................ 3-83 GCDMOD ........................... 3-96 INVMOD .......................... 3-120 MOD ............................. 3-150 MODSTO .......................... 3-150 MULTMOD ......................... 3-153 POWMOD .......................... 3-175 SUBTMOD ......................... 3-243 Maybe the question is more about these commands? Best would be to come up with an example that you need explained. Cheers Thomas |
|||
02-07-2019, 01:20 PM
(This post was last modified: 02-07-2019 01:24 PM by Albert Chan.)
Post: #5
|
|||
|
|||
RE: HP-50g Modular Arithmetic
Quote:Modulo Function: Returns a remainder defined by: x mod y = x – y floor (x/y) Although it is defined this way, it cannot be calculated same way. My guess is there is an algorithm to reduce x a bit at a time, like this ? 123e45 mod 12345 ≡ 123e9 * 1e36 ≡ 12285e7 * 1e29 ≡ 4035e8 * 1e21 ≡ 8535e8 * 1e13 ≡ 6810e8 * 1e5 ≡ 270e5 ≡ 1485 Or, reduce exponents, like this ? 123e45 mod 12345 ≡ 1e11^4 * 1230 ≡ 6475^4 * 1230 ≡ 2005^2 * 1230 ≡ 7900 * 1230 ≡ 1485 Reducing exponents way look faster, but may get into overflow issue. |
|||
02-07-2019, 02:42 PM
(This post was last modified: 02-07-2019 02:43 PM by John Keith.)
Post: #6
|
|||
|
|||
RE: HP-50g Modular Arithmetic
The 50g's POWMOD command uses the CAS variable MODULO for the modulus. Joe Horn posted a program for another calculator (the Prime, I think) that accepts a user-input modulus but I can't find it at the moment. Here is my 50g version:
Code:
Input is x, y, m to return (x^y) mod m. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: