I WAS LOOKING FOR A SMALL SOFTWARE PROJECT TO DO ON VINTAGE HARDWARE.
THE HUNT DIDN'T GO ON LONG BEFORE IT HIT ME. ONLY ONE THING COULD
POSSIBLY DO: CALCULATE PRIME NUMBERS ON MY TRUSTY PR1ME 5340
MINICOMPUTER.
THE 5340 IS A SOPHISTICATED MACHINE, CMOS BASED, AND UTILIZING CUSTOM
HIGH DENSITY GATE ARRAYS TO REDUCE THE PHYSICAL SIZE OF THE CPU AND
MAIN MEMORY (16 MB) TO WELL UNDER 225 SQUARE INCHES. POWER
CONSUMPTION IS WELL UNDER 10A, TOO, AND THE MACHINE CAN RUN WITHOUT
HEAVY AIR CONDITIONING. JUST A COUPLE OF YEARS AGO, EVEN A HIGH END
ECL DESIGN COULD NOT PROVIDE THE SAME LEVEL OF PERFORMANCE IN SEVEN
TIMES THE BOARD SPACE, AND IT STILL WOULD HAVE REQUIRED 30A TO 50A OF
WALL POWER, PLUS SEVERAL THOUSAND BTU OF CHILLING.
SINCE THE PR1ME ARCHITECTURE IS TARGETED AT SCIENTIFIC USERS, AN
ARBITRARY PRECISION NUMBER PACKAGE IS NOT READILY AVAILABLE. AFTER A
FEW TESTS, I CONCLUDED THAT THE HARDWARE QUAD PRECISION FLOATING POINT
SUPPORT WAS A POOR CHOICE DUE TO THE SCALE OF THE ROUNDING ERRORS I
WAS SEEING. THE PR1ME FLOATING POINT IMPLEMENTATION IS QUITE GOOD,
BUT WHEN ALL OF THE SIGNIFICANT DIGITS ARE TO THE LEFT OF THE DECIMAL
POINT, THERE IS VERY LITTLE IT CAN DO.
BUT ALL WAS NOT LOST, AS HAS NO DOUBT BECOME OBVIOUS BY THE POSTING OF
THIS MESSAGE. THE ARCHITECTURE ALSO SUPPORTS PACKED AND UNPACKED
DECIMAL ARITHMETIC, WHICH CERTAINLY DOESN'T SUFFER FROM ROUNDING
ERRORS. IT CAN EVEN STORE NUMBERS AS LARGE AS 63 DIGITS IN LENGTH.
PERFECT!
I WAS NOT WILLING TO SIMPLY CODE UP SOME MATHEMATICIAN'S DUBIOUS
ALGORITHM -- I WANTED TO BE SURE NOT TO MISS ANY VALID PRIMES.
INSTEAD, I CAREFULLY DESIGNED MY OWN, AND VALIDATED IT USING A LARGE
CORPUS OF TEST DATA (ALL INTEGERS BETWEEN 1 AND 100). THE CODE USES A
NUMBER OF ADVANCED TECHNIQUES FOR ACCURACY AND HIGH PERFORMANCE,
INCLUDING:
* SEQUENTIAL SEARCH FOR POSSIBLE FACTORS.
* CYCLING TO THE NEXT POTENTIAL PRIME IMMEDIATELY UPON DISCOVERING AN
INTEGRAL FACTOR, INSTEAD OF CONTINUING TO TEST ALL REMAINING POSSIBLE
FACTORS.
* TESTING ONLY FACTORS LESS THAN HALF OF THE CANDIDATE PRIME.
* NOT TESTING FOR DIVISIBLENESS BY 1.
* TESTING ONLY ODD CANDIDATE PRIMES.
* HAND-CODED IN PR1ME ASSEMBLER.
USING THESE METHODS, I WAS ABLE TO ACHIEVE REMARKABLE PERFORMANCE. IN
TESTING, THE PROGRAM EXECUTED ABOUT 3,086,913,596 DECIMAL DIVISION
OPERATIONS IN 11 HOURS AND 17 MINUTES, FINDING THE FIRST 10544 PRIME
NUMBERS, AT A RATE OF ABOUT 75994 DIVISIONS PER SECOND, AND NEARLY 935
PRIMES PER HOUR. TRY _THAT_ IN BASIC ON YOUR IBM 5150!
THE SOURCE PROGRAM, AND AN OUTPUT FILE WITH START AND END DATE STAMPS
AND THE FOUND PRIMES, ARE AVAILABLE FOR PERUSAL AT
http://yagi.h-net.msu.edu/primenumbers/.
SUGGESTIONS FOR ENHANCEMENT OR CORRECTION OF THE PROGRAM WILL BE
GRATEFULLY RECEIVED BY THE AUTHOR.
DE