Last active
April 6, 2019 11:22
-
-
Save vinloo/c875bdb32d5919c3099a7abb65c1f1e9 to your computer and use it in GitHub Desktop.
Greates Common Divisor as Linear Combination finder with steps for TI Calculators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ClrHome | |
| ClrAllLists | |
| Disp "ax + by = c" | |
| Input "a = ",A | |
| Input "b = ",B | |
| Input "c = ",C | |
| If gcd(A,B)≠C | |
| Then | |
| Disp "","Error: c ≠ gcd(a,b)" | |
| Stop | |
| End | |
| {A,B}→L₁ | |
| {1,0}→L₂ | |
| {0,1}→L₃ | |
| 1→I | |
| While L₁(dim(L₁)) | |
| I+1→I | |
| int(L₁(I-1)/L₁(I))→Q | |
| If L₁(I-1)-Ans*L₁(I)=0 | |
| Then | |
| Goto A | |
| End | |
| L₁(I-1)-Ans*L₁(I)→L₁(I+1) | |
| L₂(I-1)-Q*L₂(I)→L₂(I+1) | |
| L₃(I-1)-Q*L₃(I)→L₃(I+1) | |
| End | |
| Lbl A | |
| Disp "","x = ",L₂(dim(L₂)) | |
| Disp "y = ",L₃(dim(L₃)) | |
| L₃→L₄ | |
| L₂→L₃ | |
| 0→L₂(dim(L₁)) | |
| For(I,2,dim(L₁)) | |
| L₁(I)→L₂(I-1) | |
| End | |
| For(I,2,dim(L₄)) | |
| L₃(I)→L₅(I-1) | |
| L₄(I)→L₆(I-1) | |
| End | |
| Disp "","Press 'stat' - 'Edit...'","to see the steps table." | |
| Stop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
