We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #92: Square digit chains
You are viewing a single comment's thread. Return to all 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:
You can also read about happy numbers on wikipedia