I am trying to list the digits of pi in order using Julia
b = 1
n = 10^b
println(3.0)
for i in 0:20
println(-floor(π*n^(i))*10 + floor(π*n^(i+1)))
end
This code works for the first 15 iterations. However, after that I receive negative valued numbers, which obviously makes no sense
3.0
1.0
4.0
1.0
.
.
.
0.0
-5.795215566461698e19
2.8976077832308487e20
-2.318086226584679e20
My guess is that the n^i term is too big to handle, making my code extremely inefficient.
Is there a more efficient way, lets say to list the first 1000 digits of pi?