Is there an Algorithm to calculate the sequence of π and e using only integer, addition, subtraction, array, and loop?(changed question)

79 Views Asked by At

Someone made a computer program calculate the sequence of π and e sequentially.

The program only uses integer, addition, subtraction, array and loops.

The program is slow, but it doesn't stop and keeps printing the next number.

What are mathematical principles? Is there mathematical algorithm or recurrence relation or some formula?

1

There are 1 best solutions below

0
On BEST ANSWER

Working in binary (or hexadecimal, etc.) every multiplication/division is a chain of shifts and additions. And so are additions and subtractions.

Therefore any recurrence (like that of Archimedes for $\pi$), infinite series or product defining $\pi$ , $e $ can be converted into binary as a sequence of shifts and additions which will operate only on a certain portion of the less significant digits.