In my previous post I detailed a program for obtaining the remainder when a number like 4593 is divided by 7. I now want to show how this works and how we can find remainders even when the numbers exceed the range of input of the fx-50F.
Let's start by finding the remainder when 4593 is divided by 7. On executing the program the display shows A? A is the divisor and so input 7 and press [EXE]. Next X? is displayed. The digits of 4593 are entered here and so begin with the digit furthest to the right and input 3 and press [EXE]. Continue by entering 9, then 5, and then 4 in a similar fashion. Once 4 has been processed X? will be displayed again and to notify the program that all the digits of the number have been entered, input -1 and press [EXE]. The program then displays the value of memory C which is the result, 1. This is as expected. The remainder on dividing 4593 by 7 is 1.
In an earlier post I also showed that the 21 digit number 122130132904968017083 leaves remainder 12 when divided by 41. To confirm this we can run the program again. Enter 41 for A and then process the digits from right to left starting with 3. We obtain the result that C displays 12 as expected. Note that 21 digits exceeds the limit of 15 digits that can be stored in the fx-50F.
Finally, I return to prove that Frank Cole's calculation that the Mersenne number 147573952589676412927 is the product 193707721 × 761838257287. First, we show that 193707721 divides this number. We run the program again with 193707721 entered for A and then the 21 digits of the number 147573952589676412927 entered from right to left, finishing with -1 to terminate the input. The result is remainder 0 which is as expected since 193707721 is a factor. Secondly we run the program again with 761838257287 entered for A and then the 21 digits of 147573952589676412927. Again the remainder is 0 which shows that 761838257287 does divide 147573952589676412927.
Tuesday, 17 March 2015
Tuesday, 3 March 2015
Remainder on division - the program
I discussed the logic for this program in a previous blog. Here is the logic converted into a program for the fx-50F:-
This program is 104 steps in length.
1→B:0→C:10→D:?→A:While D≥A:D-A→D:WhileEnd:Lbl
1:?→X:X=-1=>Goto 2:While X≥A:X-A→X:WhileEnd:C+BX→C:While C≥A:C-A→C:WhileEnd:DB→B:While B≥A:B-A→B:WhileEnd:Goto 1:Lbl 2:C▲
This program is 104 steps in length.
Subscribe to:
Posts (Atom)