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.
Hi mj123, Lets take the following example
85→89→145→42→20→4→16→37→58→89
The number 85 has 82+52 = 64+25 = 89
Similarly 89 has 82+92=64+81=145
In the same way 145 gives 12+42+52 = 42
Then 42+22=20
Using 20, 22+02=4
42 = 16 and so on.
I hope you can solve it now.
printing the modulo means, if the answer you get is N
print the value of N%1000000007
eg. 20%1000000007 = 20 1000000047%1000000007=40
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 →
Hi mj123, Lets take the following example 85→89→145→42→20→4→16→37→58→89
The number 85 has 82+52 = 64+25 = 89
Similarly 89 has 82+92=64+81=145
In the same way 145 gives 12+42+52 = 42
Then 42+22=20
Using 20, 22+02=4
42 = 16
and so on.
I hope you can solve it now. printing the modulo means, if the answer you get is N print the value of N%1000000007
eg. 20%1000000007 = 20
1000000047%1000000007=40