![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
Todays post is in response to a good friend of mine always asking about the “Mumbo Jumbo” that I talk about or create during the course of my job. “Mumbo Jumbo” is actually “Japanese English” for technical talk according to some. I have to take you all back to when I was about 14 years old, this is when I purchased my first computer. My first computer wasn’t an IBM 486 or 386, or even a 286, my first computer was a Casio PB-100.
Here are the details of my first PC.

The PB-100 represents Casio’s step towards “real” pocket computers. While its ancestor, the FX-702P, was still called “Programmable Calculator”, the PB-100 proudly bears the title “Personal Computer”.
In its standard version, it is equipped with 1 KB of RAM which results in only 544 bytes for BASIC, which is really limiting. At least, with the memory module OR-1, it can be upgraded to 1568 bytes of user memory, so it begins to make sense that BASIC memory can be subdivided into 10 independent program areas.
The main circuits of the PB-100 are basically made up of two chips. Processor logics, ROM, display driver, and keyboard controller are integrated in a single CMOS VLSI chip HD61913, which has an external 4-bit bus. The second main component is a HD61914, which is a 8192-bit static RAM organized as 2048 words by 4 bits.
I had the lot, 1k ram upgrade for a total of 1.5k of ram, thermal printer and tape drive, needless to say it want a very powerful PC, but you would be surprised what could be done with such an underpowered PC, keep reading….
My first program was written in BASIC, and could calculate the Factorial of any number you like. What is Factorial ? In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example, 5! = 1 x 2 x 3 x 4 x 5 = 120 and 6! = 1 x 2 x 3 x 4 x 5 x 6 = 720. As you can imagine the numbers get very large very quickly. Most calculators, even today, can only manage 69!, this is the point where the exponent exceeds 99.
So I had a problem I want to solve, what is the factorial of 1 million, 1,000,000! logarithms to the rescue. What is a 14 year old boy doing researching logarithms you ask? I guess thats a story for another post. After a few hours of reading a book, yes a book!( no internet in those days) I was able to establish that product of integers is the sum of their logs.
so 1 * 2 * 3 * 4 * 5 … is equal to exp( log(1) + log(2) + log(3)+ log(4) + log(5) )
Easy right… yeah right!
So I embarked on my first programming task. I was able to come up with a simple routine that broke the calculation down into small chunks easily handled by any programmable calculator or PC.
10 input x
20 for a = 1 to x
30 b = b + log10(a)
40 next a
50 c = b - frac(b)
60 d = b - c
70 e = 10 ^ d
80 print e , “E+” , c
Certainly not the best way to achieve the result by todays standards, and faced with many command restrictions, still not to bad for a 14 year old boy.
You can still use this program today, go and download small basic and copy/paste the code and give it a try. It took more than 12 hours on my PB-100 to calculate 1,000,000!, now it takes about 1 second, I can now appreciate how much performance my laptop has, however my little program still beats the WindowXP calculator at Factorial.. try it and see.
So what is 1 million Factorial? 1,000,000! = 8.263930499EXP5565708, that 5.5 million zeros, give or take a few.
Now for all the other math heads who read this, I know it is an approximation as I am only using 16 significant digits, and there are more accurate ways to do this, blah blah blah, please remember I was only 14 at the time.
If you have managed to maintain interest and get to the end of this post, maybe your the type who can impress their friends with some geeky code.
|
Pauly, do you remember where you got the workings from ?…… It was me who brought the Swinburne Uni PC’s to a grinding hault in the early eighties with this Factorial Formulae on PUNCH CARDS… YES! punch card programming LOL
Remember my Casio Calculator the FX-602P?? It computed 1,000,000 factorial in 4 minutes flat, not bad for a meek calculator