Computer

# They use the 4004, the first Intel processor, to calculate the number Pi

Intel’s first processor was a 4-bit CPU that ran at 750KHz speed and only accessed up to 4KB of RAM. So its specifications are microscopic compared to what is available today even in the most modest PC. Well, someone has thought of calculating the Pi number with an Intel 4004. Which have been the results?

One way to measure the performance of a processor is through a recurring task of increasing difficulty. One example is cryptography algorithms, but there are other more classic and well-known ones, such as the search for prime numbers or the different decimal places of π. Let us remember that it is a number that has an infinite number of decimal places and the search for them is, therefore, a small challenge for any processor. However, until now, no one had been able to calculate the number pí (π) on an Intel 4004.

To achieve this, they have mounted the veteran processor on an STM32 that they have used to simulate the peripherals and be able to program it. Let’s not forget that the Intel 4004 is more like a microcontroller in operation than a PC CPU. Honor that belongs to the Intel 8080 as the first, as it is used on the legendary Altair 8800 from MITS.

## How long does it take for the Intel 4004 to calculate the number pi (π)?

Well, the answer to the question is obvious, it takes the same time as any other processor, since we are an irrational number of infinite decimal places. So the performance test or benchmark consists of measuring the speed it takes to know the value of the next decimal of the eternal and endless list.

The challenge of doing so with something as simple as an Intel 4004 means having to overcome a number of key limitations:

• The fact that the instruction set is very limited.
• It does not have a floating point unit, because it does not have it, it does not even have the ability to multiply numbers.
• Your programs can’t be more than 4 KB because of its 4 KB address, but you need an external multiplexer to do that, otherwise it stays at 1280 bytes.
• The unit in charge of mathematical calculation does not use the most efficient logic gateswhich leads to it being much slower.
• Your clock speed is 750Khz, that is, 750,000 cycles per second. An Intel Core or an AMD Ryzen of today?
• It is not a processor that supports segmented execution, so it does not perform several stages in different parts of it.

Although the key question is the one we have put as the title of this section and the answer to it is: 3 hours 31 minutes and 13 seconds to obtain the first 255 digits of the number pi (π) with Intel 4004. For this they have used the Double–Stan algorithm, which is based on using integer division and avoids the use of decimals in order to make it easier for the extremely limited first Intel processor. As a comparison, the same person who has run the test has obtained 25 million digits in one second with a Xeon.