# Microcomputer Mathemagic

WELCOME to Micro-Magic! In this column, during the forthcoming months, I would like to share with you some interesting recreational mathematics and computer applications which have been sadly neglected in our schools. I hope that this column will not only amuse and entertain you. but also stimulate you to think about the whys, hows and even the what-ifs. It is also almost certain to have the bonus effect of improving programming know-how — at least it has for me. I hope to hear directly from readers who have some of their own micro-magic which they might allow me to share, as well as superior programs or any other feedback you wish.

### DIGIT PREDICTION:

One of the most popular types of parlor tricks is the “prediction” type. In this amusement, the computer asks you to pick any whole number, which is not revealed or INPUTted. Let’s say you pick 1234. You are next asked to add up the digits to your number. In this case, 1+2+3+4=10. Now subtract this last result from your original number (either mentally, or if you must, on a hand calculator). We now have 1234-10=1224.

This is where the computer “does its stuff”. It now asks you to think of any digit (other than 0) in the last answer (1224 in the above). You then enter the number that is left over after you remove the digit that you’ve picked. If you picked “4”, enter 122 when requested. The computer will tell you the digit you picked (in this case, 4)!

Though the digit prediction program (program number one) was produced on a TRS-80 model 3, it is easily modifiable. Make appropriate modifications for your computer such as the ‘clear screen’ command (CLS for TRS-80, HOME for Apple, etc.). CHR$(23) produces double width letters for the TRS-80.

### THE REMARKABLE NUMBER 153

Take any whole number which is a multiple of 3 (3, 6, 9, 12, 15, 18, etc.). Suppose you picked 345. Take the cube of each digit and add the cubes: 3*3*3=27. 4*4*4=64. 5*5*5=125. 27+64+125=216.

Now repeat this with the number 216. You should get 225. Repeating gives 141, then 66; then 432; 99; 1458; 702; then 351 and next 153. Once it hits 153 you will find that you keep getting 153 because 1*1*1 + 5*5*5 + 3*3*3 = 1 + 125 + 27 = 153 again!

The remarkable fact is that no matter what multiple of 3 with which you begin, you must eventually hit the number 153. Program two will take any input and test to verify that you have used a multiple of 3. If so, it will then calculate and display the numbers obtained in this process. Readers who are curious as to what happens if the original whole number is not a multiple of 3 are encouraged to modify the program to skip the initial test. In any case, the program terminates when the next number obtained is the same as the previous one. In the case of starting with a multiple of 3, it turns out that 153 is the only multiple of 3 which is the sum of the cubes of its digits, and so the unmodified program should always terminate with 153.

Readers who wish to correspond are encouraged to write me directly. Useful suggestions will be acknowledged, and very original and especially useful ideas may sometimes result in several months subscription extensions courtesy of our generous editor. My address is:

Dr. Michael W. Ecker

COMPUTER GAMING WORLD

Luzerne 8

Viewmont Village

Scranton, PA 18508

*Dr. Michael W. Ecker is Assistant Professor of Mathematics at the Pennsylvania State University’s Worthington Scranton Campus in the Scranton, PA area. He is known for his interest in problem solving and recreational math, as well as his newfound addiction for home computing — especially computer gaming.*