Skip to content

Latest commit

 

History

History

228-to-pi-or-not-to-pi

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

To PI or not to PI

Challenge Description:

As we know from our school history course, the ancient civilizations needed π (PI) value for the mathematical calculations. In the 5th century, the Chinese mathematicians calculated this value to seven decimal digits by using geometrical technics. In Indian mathematics, it was calculated to five decimal digits. As the computer science developed, the mathematicians managed to calculate the decimal representation of PI to over 10 trillion digits.
Surely, we do not need the PI value calculated to 10 trillion digits, but 5000 digits sound just right. So, we need to define the number located at the certain sequence number in PI.

Figure 1

Input sample:

The first argument is a path to a file. Each line includes a test case, which comprises a number indicating the sequence number of a PI value.

3
1
1654

Output sample:

Print the number that is located at that sequence number.

4
3
1

Constraints:

  1. The sequence number cannot exceed 5000.
  2. Comma in the PI value is not a sequence number element.
  3. The number of test cases is 30.