2**2**2**2**2 wrong? Bug?

mensanator at aol.com mensanator at aol.com
Tue Jul 10 08:51:25 CEST 2007


On Jul 9, 11:42?pm, Paul McGuire <p... at austin.rr.com> wrote:
> On Jul 9, 11:21 pm, "Jim Langston" <tazmas... at rocketmail.com> wrote:> In Python 2.5 on intel, the statement
> > 2**2**2**2**2
> > evaluates to>>> 2**2**2**2**2
>
> > 200352993040684646497907235156025575044782547556975141926501697371089405955  63114
> > 530895061308809333481010382343429072631818229493821188126688695063647615470  29165
> > 041871916351587966347219442930927982084309104855990570159318959639524863372  36720
>
> <snip>
>
> Exponentiation is right associative, so this is the same as:
>
> 2**(2**(2**(2**2)))
> 2**2**2**4
> 2**2**16
> 2**65536
>
> 2=10**0.3010, so 2**65536 is approx 10**19726
>
> There are 19730 digits in your answer,

>>> import gmpy
>>> n = 2**2**2**2**2
>>> gmpy.numdigits(n)
19729

Did you count the 'L'?

>so this seems to be at least in
> the ball park.
>
> -- Paul





More information about the Python-list mailing list