Project Euler #92: Square digit chains

  • + 0 comments

    Because I got frustrated with the problem, I made a dictionary of all digits whose chain of square of digits reaches 1 which can be found in this OEIS link for numbers upto 200 and then return:

    print((10**k-(d[k]%MOD))%MOD)
    

    You can also read about happy numbers on wikipedia