Euler92

Problem 92 - Square Digit Chains

counter1 = 0  

 
for number in range(1, 10000000):  

    temp = number  
    
    while temp != 1 and temp != 89:  
        temp_sum = 0  
        for n in str(temp):  
            temp_sum += int(n)**2  
        temp = temp_sum  
    if temp == 89:  
        counter1 += 1  


print(counter1)  

Gives an output of 8,581,146