Pi | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Pi

Anyone can get the Nth decimal value of pi?

21st May 2020, 1:47 PM
Jefferson Jadoc
Jefferson Jadoc - avatar
3 Answers
+ 2
You might want to apply any of the algorithms here: https://en.m.wikipedia.org/wiki/Category:Pi_algorithms Then convert the result to a string and look for the character with Nth index (or N-1 for most languages). For just finding the Nth digit without calculating the π itself, try the BBP formula: https://en.m.wikipedia.org/wiki/Bailey%E2%80%93Borwein%E2%80%93Plouffe_formula
21st May 2020, 1:54 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
Here's a comparison of python's internal value of pi to value of pi from the code coach involving 1000 digits of pi. Python's pi is good for 15 decimal places. https://code.sololearn.com/c9We9fWe9ob3
2nd Nov 2020, 7:15 PM
Rick Shiffman
Rick Shiffman - avatar
- 2
I guess the answer is 3.14 don't even bother to ask how i got it because i just guessed.
21st May 2020, 1:51 PM
Ikhuoria .E. Josephine
Ikhuoria .E. Josephine - avatar