Sure Tom, for example, let's print the first 200 digits of pi.
Since I am getting about 1.2 * $n correct digits for a 0..$n range when calling the plouffe subroutine, it is sufficient to use the 0..200 range to get (more than) 200 correct digits. sub plouffe (Int $k) { my $result = (1.FatRat / 16 ** $k) * ( (4 / (8 * $k + 1)) - (2 / (8 * $k + 4)) - (1 / (8 * $k + 5)) - (1 / (8 * $k + 6) ) ); } # printing 200 digits of pi my $pi = [+] (plouffe $_ for 0..200); print substr $pi, 0, 201; Result (reformatted): 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348 253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055 596446229489549303819 Note that $pi contains a lot more digits, many of which are not correct, but the first 201 digits are correct, so I only need to keep the number that are required. Cheers, Laurent. Le ven. 19 avr. 2019 à 21:47, Tom Browder <tom.brow...@gmail.com> a écrit : > On Fri, Apr 19, 2019 at 08:37 Laurent Rosenfeld via perl6-users < > perl6-us...@perl.org> wrote: > >> Hello, >> >> in the context of the Perl Weekly Challenge, I was trying to use one of >> Franco-Canadian mathematician Simon Plouffe's formulas to compute the >> digits of pi. >> > > Laurent, now that you have the algorithm working as desired, can you show > how to print all the digits for any N? > > Best, > > -Tom >