10 REM"* M A X I N F 0 * 20 REM Information and instructions for "Maxiply" - program for multiplying very large numbers. 30 MODE7:VDU23,1,0;0;0;0; 40 PRINTTAB(3)"MAXINFO - 'MAXIPLY' INFORMATION" 50 PRINTTAB(3)"MAXINFO - 'MAXIPLY' INFORMATION" 60 PRINT"";STRING$(39,"s") 70 PRINT" Seeing the references in 8BS issues 35 and 36 to a routine for multiplying large numbers together, called Fermat, prompted me to haul out, dust down, andpolish up a program originally worked out on an MSX." 80 PRINT" This program, called Maxiply, will multiply two numbers with, in essence, an infinite number of digits. The only limitations are the amount of memory available, and the length of time you want to run your computer." 90 PRINT" With the memory available on the 32K Beeb, you can multiply any two numbers which give an answer up to 3000 digits long, for example two 1500 digit numbers, or a 2900 digit number by a 100 digit number." 100 PROCpage 110 PRINTTAB(13)"MAXINFO 2" 120 PRINT"";STRING$(39,"`"):VDU11 130 PRINT" It doesn't matter whether the larger number is entered first or second - theonly difference is that if it's enteredsecond there will be more progress and time checks displayed." 140 PRINT" The program works by multiplying and adding in groups, which gets a little complicated, but speeds things up. On average, it runs about twice as fast asthe Fermat routine, which also seems tohave a size limit."; 150 PRINT" The program works its way through the numbers from left to right, to simplify the arrays." 160 PRINT" Most of the program length is taken up with input and output routines and options, and checking procedures.If youwanted more memory for even larger numbers, you could - carefully - removesome of these, "; 170 PRINT"and then just increase the DIM's and MAX%." 180 PROCpage 190 PRINTTAB(3)"MAXINFO 3 -INPUT INSTRUCTIONS 1" 200 PRINT"";STRING$(39,"`"):VDU11 210 PRINT"1)Numbers can be entered digit by digit, in groups of 238, up to 3000 digits for the first number, and to (3000-1st no. digits) for the second. A running total and total left ('max') is given at each stage."; 220 PRINT" Each time you get to another 238 digits (you can't enter more at one go), enter these, andafter a short checking pause, you will be prompted to continue the number. If you enter less than 238 digits in any section, "; 230 PRINT"the program will then continueto either the second number or the calculations." 240 PRINT"2)You can enter a decimal point at anystage (this was difficult!) in either the first or second numbers, or both, and carry on with additional groups of 238 digits.The section with the decimalpoint will be 237 digits long." 250 PROCpage 260 PRINTTAB(3)"MAXINFO 4 -INPUT INSTRUCTIONS 2" 270 PRINT"";STRING$(39,"`"):VDU11 280 PRINT"3)You can enter just 'R' for either number and you will get a random numberof a random length between 1 and 300 digits." 290 PRINT"4)To get a random number of a specificlength, enter 'R' plus the number of digits you want. For example, R1275 will give you a random number 1275 digits long." 300 PRINT"5)Entering 'R0'(zero) will give you a random number of a random length between 1 and 1200 digits." 310 PRINT"6)You can square the first number, whether entered directly or as a randomnumber, by just entering 'S' when prompted for the second number." 320 PRINT"7)Entering 'I' at the First Number prompt will return you to these notes." 330 PRINT"8)Escape gives you a new run option." 340 PROCpage 350 PRINTTAB(9)"MAXINFO 5 -NOTES 1" 360 PRINT"";STRING$(39,"`"):VDU11 370 PRINT"1)Inputs for the first and second numbers can be freely mixed. The first number, for example, can be direct input, and the second a random number." 380 PRINT"2)If you try to enter too many digits at any stage, you will be told about it!" 390 PRINT"3)The checking procedure will remove anything that isn't useful, such as stray letters, symbols, spaces and unwanted zeros. To see this, enter a mixture of a few digits and a lot of gobbledegook (except commas) "; 400 PRINT"for the first number, and then square it." 410 PRINT"4)Don't worry if a large answer zooms past at the end. The answer, and the original numbers, can be recalled and displayed at the end, and there are also print options." 420 PROCpage 430 PRINTTAB(9)"MAXINFO 6 -NOTES 2" 440 PRINT"";STRING$(39,"`"):VDU11 450 PRINT"5)To get a large answer relatively quickly, multiply a very large number by a smallish one, rather than two similar sized numbers." 460 PRINT"6)To aid rapid direct input, function keys 0 and 1 hold ten digit numbers." 470 PRINT"7)Squaring a lot of 9's produces interesting results, as do 3's and 6's,and multiplying variations on equal numbers of 3's, 6's, and 9's. This is also a good quick test of whether the program is working properly!" 480 PRINT"8)If you did a multiplication on a (rather large) piece of paper which had an answer 3000 digits long, that answer would be over sixty feet long. And it would only take about a year..." 490 PRINT"";STRING$(39,"p") 500 PRINT'"PRESS:SPACEto run Maxiply. Ito repeat Information."; 510 G$=GET$ 520 IF G$="I" RUN ELSE CHAIN"MAXIPLY" 530 DEFPROCpage 540 PRINT"";STRING$(39,"p") 550 PRINTTAB(24)"PRESS SPACE"; 560 G=GET:CLS 570 ENDPROC