way to calculate 2**1000 without expanding it?
arnodel at gmail.com
Fri Sep 16 22:17:45 CEST 2011
On 16 September 2011 21:06, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> On Fri, Sep 16, 2011 at 1:21 PM, zombie <thatiparthysreenivas at gmail.com> wrote:
>> Hi guys,
>> i am writing a program to sum up the digits of a number 2**1000?
>> Is there a way/formula to do it without expanding it?
> Possibly, but why worry about it? It's only around 300 digits.
> Since this sounds like homework, I won't post the one-liner I used to
> do it the brute-force way, but I will note that it takes about 200
> microseconds to run on my laptop.
Ah go on, let's make a codegolf contest out of it.
More information about the Python-list