[Edu-sig] generate digits of pi

Kirby Urner kurner at oreillyschool.com
Sun Dec 23 02:34:38 CET 2012


Got it, no wrong digits just not always exactly the number you asked for.

This happens often in 3.2 as well:

>>> exp = ((n,len(list(pi_digits(n)))) for n in range(10000))  # (number
asked, number got)
>>> exp2 = ((a,b) for a,b in exp if a != b)  # filter on "not same"
>>> for i in range(10): print(next(exp2), end=", ")
(2, 3), (4, 5), (10, 11), (16, 17), (18, 19), (22, 23), (28, 31), (29, 31),
(30, 31), (34, 36),

Kirby


On Sat, Dec 22, 2012 at 4:40 PM, <david at handysoftware.com> wrote:

> In each case I asked for only 79 digits, but got 79, 82, and 83 digits
> depending on whether I was using python 3.2, python 2.6, or python 2.6 with
> -Qnew, respectively. The digits all seem to be correct, but the algorithm
> for stopping at digit n seems to be very sensitive.
>
>
>
> David H
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20121222/9adafa71/attachment.html>


More information about the Edu-sig mailing list