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

Wayne Brehaut wbrehaut at mcsnet.ca
Fri Jul 13 15:52:53 EDT 2007


On Fri, 13 Jul 2007 11:30:16 -0700, Paul McGuire <ptmcg at austin.rr.com>
wrote:

>On Jul 13, 1:20 pm, Wayne Brehaut <wbreh... at mcsnet.ca> wrote:
>> On Mon, 09 Jul 2007 23:51:25 -0700, "mensana... at aol.com"
>>
>>
>>
>>
>>
>> <mensana... at aol.com> wrote:
>> >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'?
>>
>> numdigits(n)?
>>
>> What?  'L' is a digit in Python?  I'm going back to Fortran!
>>
>> wwwayne
>>
>>
>>
>> >>so this seems to be at least in
>> >> the ball park.
>>
>> >> -- Paul- Hide quoted text -
>>
>> - Show quoted text -- Hide quoted text -
>>
>> - Show quoted text -
>
>'L' counts for 50, but only when you use Roman font.

WTL?!  Not Times  New Roman I hope?

Now I'll have to extend my remarks below to include:

	L**L**L
	D**D**D
	M**M**M
	etc. (since I don't recall what comes next)

though these (L, D, M, ...)  would seem to be numbers rather than
digits: the Romans used a base-1 system [for purposes of this
argument, at least] so  I is the only Roman digit* and the others are
just shorthand for:

   I = 1
   V = IIIII
   X = I*10
   L = I*50
   D = I*500
   M = I*1000
   etc.

---
For those who don't know which Roman digit I represents:

   |
_\|/__

wwwayne

>
>-- Paul



More information about the Python-list mailing list