Publication: Sinc-Link
Pub Details: Sinc-Link v8 n5 (Volume 8, Issue 5)
Date: September/October 1990
Pages: 11
The following listing “multip.B2”, is based on an article entitled “Russian Peasant Multiplication”, by Dale Fritz, that appeared in an exchange newsletter (I’ve lost track of which one it was, sorry about that). I shall quote from the article:
“..This is a method to multiply two integers, using only addition, doubling, and halving. Granted, it is not as fast as our decimal system, but how does it work???” Beats me, gfc!
5 REM Russian Peasant Multiplication
6 REM
7 REM From the Seattle T/S User Grp June 1990 newsletter
10 INPUT "First number ";x
15 LET product=0
20 INPUT "Second Number ";y
30 IF x=0 THEN PRINT product: STOP
40 IF x/2¼½INT (x/2) THEN LET product=product+y
50 LET x=INT (x/2)
60 IF x½0 THEN LET y=2*y
70 GO TO 30
100 STOP
9000 PRINT USR 100: SAVE "peasan.B1"
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.