TI-BASIC:Modular Arithmetic Solver: Difference between revisions
Initial automated import |
Automated @@ correction |
||
Line 1: | Line 1: | ||
{{Template:TI-BASIC:Routine | {{Template:TI-BASIC:Routine | ||
|picture= | |picture= | ||
|summary=Finds the remainder of a division between two numbers. | |summary=Finds the remainder of a division between two numbers. | ||
|input=A,M | |input=A,M | ||
|output= | |output= | ||
|variable=A,M | |variable=A,M | ||
|compatibility=TI-83/84/+/SE | |compatibility=TI-83/84/+/SE | ||
|author= | |author= | ||
|authors= | |authors= | ||
|url= | |url= | ||
|download= | |download= | ||
}} | }} | ||
Latest revision as of 22:12, 24 February 2016
Routine Summary
Finds the remainder of a division between two numbers.
Inputs
A,M
Outputs
Variables Used
A,M
Calculator Compatibility
TI-83/84/+/SE
Download
No download provided.
:A-Mint(A/M
This program takes modular equations of the form X ≡ A (mod M) and solves them for the common residue, which is equal to the remainder after A has been divided by M. Among other things, it can be useful for finding the day of the week (with Sunday–Saturday matching up with 0–6) after M number of days has passed, or the time on a clock after a number of hours has passed.
For example, if we were on a Saturday (which is day 6, given that Sunday is day 0), and we wanted to figure out what it will be in 18 days, we would store 6+18→A, then 7→M as the appropriate number of days in a week, and finally we would calculate MfPart(A/M to get 3, which translates to a Wednesday.
This simpler version can be used if A is guaranteed to be positive:
:MfPart(A/M
It may fail due to rounding precision errors.