Post Reply 
(32SII) Solving a Single Congruence Equation for the HP 32Sii
01-16-2014, 05:58 AM (This post was last modified: 01-16-2014 06:20 AM by Thomas Klemm.)
Post: #2
RE: Solving a Single Congruence Equation for the HP 32Sii
Instead of brute force the Chinese remainder theorem could be used. This program for the HP-11C can easily be translated to the HP-32Sii or most other HP calculators.


001 LBL A
002 STO 1
003 STO 5
004 R↓
005 STO 6
006 R↓
007 STO 2
008 0
009 STO 3
010 1
011 STO 4
012 LBL 0
013 RCL 1
014 RCL 2
015 /
016 INT
017 STO 0
018 RCL 3
019 RCL 4
020 STO 3
021 RCL 0
022 *
023 -
024 STO 4
025 RCL 1
026 RCL 2
027 STO 1
028 RCL 0
029 *
030 -
031 STO 2
032 X≠0
033 GTO 0
034 RCL 5
035 RCL 3
036 X<0
037 +
038 RCL 6
039 *
040 ENTER
041 ENTER
042 RCL 5
043 /
044 INT
045 RCL 5
046 *
047 -
048 RTN


Usage:

A ENTER
B ENTER
N
GSB A


Example:
5 * x = 3 mod 17

5 ENTER
3 ENTER
17
GSB A

4


Restriction:
gcd(A, N) = 1
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Solving a Single Congruence Equation for the HP 32Sii - Thomas Klemm - 01-16-2014 05:58 AM



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