way to calculate 2**1000 without expanding it?
ramit.prasad at jpmorgan.com
Fri Sep 16 22:16:03 CEST 2011
>> 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?
>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.
If you happen to be new to Python, I will say I used these functions to create a one liner (in alphabetical order).
Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.
More information about the Python-list