Pi truncated to 41 decimal digits (40 places) is
If we ignore the decimal point and list the digits as a sequence of positive integers, avoiding duplicates, we get
3 1 4 15 9 2 6 5 35 8 97 93 23 84 62 64 33 83 27 950 28 841 971 (OEIS A064809).
15 appears in the sequence instead of
1 5 because
1 had already occurred.
Also note that
0 does not occur because it is not positive;
950 contains the first zero.)
To construct the first pirrational number we use this sequence to index into the digits of Pi (the first digit being 3, the second 1, etc.).
So the first digit of the first pirrational number is the 3rd digit of Pi,
the second digit is the 1st digit of Pi,
the third digit is the 4th digit of Pi,
the fourth is the 15th digit of Pi,
and so on.
A decimal point is added after the first digit to mimic Pi.
Thus the first pirrational number to 41 digits is
(Note that for the 30th digit I had to go all the way to the 974th digit of Pi.)
To construct the second pirrational number the process is repeated using the first pirrational number instead of Pi. (Pi itself may be called the zeroth pirrational number.) So the new sequence is
4 3 1 9 5 19 58 ... and the first piirational number is indexed to produce the second, which starts
Further pirrational numbers are created in the same way, each being generated from the one before.
Your task is to write the shortest program possible that takes in two integers,
D, and outputs the
Nth pirrational number truncated to
D decimal digits.
D is always positive but
N is non-negative, and
D digits of Pi should be output when
N is 0.
D is 1 it does not matter if the decimal point is present or not.
The input should come from stdin or the command line and output should go to stdout (or your language's closest alternatives).
Your program should work for all input values of
D below 216, but it needn't be timely or efficient.
The shortest code in bytes wins.
(Note that pirrational numbers exits in other bases but everything in this challenge is done in base 10.)