way to calculate 2**1000 without expanding it?

Mark Dickinson dickinsm at gmail.com
Sun Sep 18 08:13:03 EDT 2011


On Sep 16, 9:17 pm, Arnaud Delobelle <arno... at gmail.com> wrote:
> Ah go on, let's make a codegolf contest out of it.
> My entry:
>
> >>> sum(map(int,str(2**1000)))

You could save another character by replacing "2**1000" with "2<<999"

--
Mark



More information about the Python-list mailing list