Intel's 50-Year-Old 4040 CPU Optimized, Battles ENIAC in Pi-2035 Calculation Race

Intel 4040 SBC
(Image credit: Mark Engineer)

A tech enthusiast has coaxed his Intel 4040 CPU single board computer into outrunning ENIAC in a race to calculate Pi to 2035 decimal places. Both Pi computation contenders rely upon several decades-old technology, but despite the 30-year advantage held by the Intel 4040, it was a surprisingly tough race. 

The Intel 4040 was fabricated on a 10-micrometer process node and packed in 3,000 transistors. It was designed as a 4-bit processor, running at 740 kHz, and introduced in 1974. Intel’s silicon chip is thus about 30 years younger than the WWII-era Electronic Numerical Integrator and Computer, or ENIAC, famous for being among the first general-purpose computers. In contrast to the tiny Intel 4040, this wartime computer took up 1,500 sq ft of space and included tens of thousands of resistors, vacuum tubes, capacitors, switches, and relays. You can’t put that on an SBC.

ENIAC calculated Pi to 2035 decimal places in 70 hours when tested back in 1949. ‘Mark Engineer,’ the tech enthusiast behind the project, had previously tried to outrun ENIAC using an SBC equipped with an Intel 4004 (Intel’s first commercial CPU). That attempt wasn’t successful, so he turned his attention to the CPU’s successor, the Intel 4040. On his blog, Mark outlined some of the advances delivered with 1974’s Intel 4040. New features, like the processor’s extended instruction set, gave him hope of success in his ENIAC-trumping quest.

The Intel 4040 SBC toting engineer stuck to some self-imposed limits so that the 1974-vintage chip didn’t have any sort of unfair or overly modern advantage against ENIAC. Thus, the little SBC would have to rely on pure computation speed to win, couldn’t use extra I/O ports, and would inherit 1975-era restrictions like that 740 kHz clock speed and 1280 bytes of RAM.

Mark set out these restrictions like any good comparative tester should, and the next section of his lengthy blog mulled over the mathematical algorithm alternatives and choices he was going to make.

(Image credit: Mark Engineer)

First Test Run Took 14.5 Years = Optimization Required

Understandably, for the testing and Pi calculation code refinement stage, Mark used an emulator. That was a good choice as he saw that his maiden voyage of Pi-2035 discovery using the method he had come up with and the virtual 4040 chip was way off target. The tech tinkerer determined that his unoptimized methodology would mean the actual 4040 SBC would need 14.5 years to calculate Pi to the requisite number of decimal places.

Working on the algorithm implementation, the system working memory use, the fixed precision number format, and finding a faster path for big primes were important to speeding up Pi calculation on the Intel 4040. Moreover, working on the early Intel processor’s peculiarities, like how it was much more efficient at addition than subtraction, also paid dividends.

After he was able to pip ENIAC to the post using the 4040 emulator with a calculation time of 69h 29m 02s, Mark was at last comfortable to move over to the real hardware. He provides extensive hardware information, schematics, and information about firmware for those wishing to delve deeper.

Intel 4040 SBC schematic (Image credit: Mark Engineer)

The Pi-2048 calculation on real hardware was very close to what we saw on the emulator. Mark was happy to end his journey with a time of 69h 28m 31s when using the actual Intel 4040 SBC. In case you are wondering, he even explains the modest time discrepancy observed between emulation vs real hardware. Mark says that the difference is likely due to the clock signal generated from stm32 timers, which he said was 740.1kHz on the physical hardware – a very slight overclock...

Calculating Pi-2035 Today is Trivial

Computing Pi to a great degree of accuracy is still a key CPU benchmark in 2023. You can see this benchmarking metric compared and discussed in our latest Intel Core i9-14900K review. Nowadays, multithreading-friendly benchmarking apps like y-cruncher can be used to calculate Pi to trillions of digits.

Modern laptop performance (Image credit: Future)

Out of curiosity, this currently laptop-bound writer decided to calculate Pi to 2035 digits on his old-ish Core i5-8365U laptop. It achieved this feat in around 0.1 seconds. A smartphone Pi calculating app on a mid-range Android phone repeated the 0.1-second feat. 

Mark Tyson
Freelance News Writer

Mark Tyson is a Freelance News Writer at Tom's Hardware US. He enjoys covering the full breadth of PC tech; from business and semiconductor design to products approaching the edge of reason.

  • MeeLee
    So, how quick could the chip calculate pi, with frequency limitation removed?
  • Rob1C
    "How many digits of pi would we need to calculate the circumference of a circle with a radius of 46 billion light years to an accuracy equal to the diameter of a hydrogen atom, the simplest atom?

    It turns out that 37 decimal places (38 digits, including the number 3 to the left of the decimal point) would be quite sufficient."

  • purpleduggy
    i wish these old chips could be made at 4nm node. imagine a 486DX4 (yes i know its much newer than the chip in the article) but made at 4nm node. I bet it would use almost zero power, but allow us to run all the legacy OS and applications and games at a fraction of the power and in a much smaller form factor. I bet they could compact a 486DX4 with the best video card from the time, as well as RAM and one of the best sound cards on an SBC the size of a raspberry pi. would propably use less than a watt for the whole thing at 4nm node. Intel should really licence to a third party or even do it themselves as a side project for retro collectors and gamers. If they do it right, with the best video cores and sound cores and making sure to hit all the right checkboxes with analog purists for eg. svga out but done well. it would be incredibly popular and would make many handheld consoles possible but with incredible batterylife because of the node efficiency. much of the old patents have expired for vintage computers so it would be possible to resurrect them in a smaller node. im sure intel still has the designs kicking around somewhere. could do one for the 486dx4 and one for the pentium 200mmx. those are pretty much the sweetspot for most DOS games apart from 286 and 386.