Sum of Digits, properties, hint please
Question: This is the problem:

> How many integers 0 ≤ n < 10^18 have the property that the sum of the digits
> of n equals the sum of digits of 137n?

This solution is grossly inefficient. What am I missing?

    
    
    #!/usr/bin/env python
    #coding: utf-8
    
    import time
    from timestrings import *
    
    start = time.clock()
    
    maxpower = 18
    count = 0
    
    for i in range(0, 10 ** maxpower - 1):
        if i % 9 == 0:
            result1 = list(str(i))
            result2 = list(str(137 * i))
            sum1 = 0
            for j in result1:
                sum1 += int(j)
            sum2 = 0
            for j in result2:
                sum2 += int(j)
            if sum1 == sum2:
                print (i, sum1)
                count += 1
    
    finish = time.clock()
    
    print ("Project Euler, Project 290")
    print ()
    print ("Answer:", count)
    print ("Time:", stringifytime(finish - start))
    


Answer: You are trying to solve a Project Euler problem by brute force. That may work
for the first few problems, but for most problems you need think of a more
sophisticated approach.

Since it is IMHO not OK to give advice specific to this problem, take a look
at the general advice in [this
answer](http://stackoverflow.com/questions/1537306/recommended-reading-for-
solving-project-euler-problems/1537531#1537531).

