Summing up digits !
Question: Hi I have been trying out this
[problem](http://mathalon.in/?page=show_problem.php&pid=133):

> Suppose P(n) is sum of digits of 2^n  
>  For example:  
>  As 2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26,so
> P(15)=26.  
>  Catulate sum of the P(n) for n=1 to 10000.

Here is my [python code](http://ideone.com/7fAWQ) which is giving **67783431**
as answer but the judge doesn't seems to be agree on this:

    
    
    def P(n):
        n = int(1<<n)
        S = 0
        while n != 0:
            S += (n%10)
            n /= 10
        return S
    
    Sum = 0
    for i in range(1,10001):
        Sum += P(i)
    else:
        print(Sum)
    

Could anybody tell me what's wrong in my approach? I would be appreciate if
somebody points me to a mathematical solution for the same.


Answer: If you had shown the comments, you would've noticed that the site owners, or
problem maintainer, is a moron.

He meant to say from "0 to 10000", not "1 to 10000", but apparently the
problem cannot be edited, or the maintainer don't want to do it.

The sum is off by 1 since `1<<0` is 1, which adds 1 to the sum.

Try submitting 67783432.

**Note** : I realize that calling the site owners or the maintainer a moron
might sound harsh, but when posting content on a site about "Mathematics",
accuracy is kinda important. Having such a site without the ability, or the
requirement, to fix wrong problems, seems kinda stupid to me.

