I wonder if this could have been done using a giant dc program in order to avoid multiple invocations of bc?
Hilarious. A few years back I would do something similar. I calculated the constant e to several decimal places by using a Taylor series and making my own rational “type” in bash represented by 2 integers.
With some liberal use of euclidean algo to reduce the fractions you can keep the denominator from exploding.
Which just leaves printing the final result at the end. That was fun.
Found it: https://gist.github.com/shanemhansen/cd8f4178d33740b3e835
MJD post - upvote.
Agreed. He is always worth reading.