0
Digits of pi
So there is a code in code coach which I need to define the Nth number of decimal for pi but importing it from math would give just 15 decimals I solved this code but not in the best way so I was wondering if there is a syntax or smth that I can do to solve and write this code in cleaner and better way https://code.sololearn.com/czn2ktGgXVJK/?ref=app
11 ответов
+ 4
https://code.sololearn.com/cIXl46bNLT4c/?ref=app
Edit:i see what you mean by the 15 decimals though. you could try mpmath --> https://stackoverflow.com/questions/9004789/1000-digits-of-pi-in-JUMP_LINK__&&__python__&&__JUMP_LINK#13316984
Alright pedram ch , here it is:
+ 2
Yes, Slick
this is not what He is looking for. This one don't work for the 850.th dezimal.
+ 1
Have look here
https://gist.github.com/markhamilton1/9716714
+ 1
Slick oh I think I should take time to understand it
Thank you for sharing
+ 1
dont even worry about subprocess and sys, thats just how you can import some 3rd party modules. the important stuff is the simplicity of mp.math. you could make your own algorithm if you really wanted to though
+ 1
Slick now I understand thank you so much for the help
+ 1
Slick
Very nice 👍
I didn't know that.
+ 1
Import math
Print (math.pi)
0
Thomas thank you for the reply
I saw the code. It generates the pi to the infinite if im not wrong
But my question was let's consider pi as 3.14159 and we want to find fifth decimal of it which is 9
How can we have pi with number of decimals we want not only 15 decimals limit which is in importing it from math
0
list="31415926535 8979323846 2643383279 5028841971 6939937510 5820974944 5923078164 0628620899 8628034825 3421170679 8214808651 3282306647 0938446095 5058223172 5359408128 4811174502 8410270193 8521105559 6446229489 5493038196 4428810975 6659334461 2847564823 3786783165 2712019091 4564856692 3460348610 4543266482 1339360726 0249141273 7245870066 0631558817 4881520920 9628292540 9171536436 7892590360 0113305305 4882046652 1384146951 9415116094 3305727036 5759591953 0921861173 8193261179 3105118548 0744623799 6274956735 1885752724 8912279381 8301194912 9833673362 4406566430 8602139494 6395224737 1907021798 6094370277 0539217176 2931767523 8467481846 7669405132 0005681271 4526356082 7785771342 7577896091 7363717872 1468440901 2249534301 4654958537 1050792279 6892589235 4201995611 2129021960 8640344181 5981362977 4771309960 5187072113 4999999837 2978049951 0597317328 1609631859 5024459455 3469083026 4252230825 3344685035 2619311881 7101000313 7838752886 5875332083 8142061717 7669147303 5982534904 2875546873 11595
- 2
Can one find work with certificate earned from sololearn?