I am trying to make a constant random number generators (I mean a RNG that outputs a series of numbers that doesn’t repeat, but stays the same every time it starts from the beginning). I have one for pi. I need an algorithm to generate e digit by digit to feed into the RNG, preferably in form of Python iterator or generator. I also welcome codes that generates other irrational numbers. Thanks in advance.
Share
Yes! I did it with continued fraction!
I found these code from Generating digits of square root of 2
I made the continued fraction generator:
and put them together:
Then:
Bonus: Code to generate continued fraction for sqrt(n) where n is a positive integer and sqrt(n) is irrational: