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.
This is much harder than the original question. I can solve the original question in 3 seconds (Python 3), but the following changes make it much much harder:
n could be 10^100 instead of 10^20 (at 10^20 I'm at 3s, the sum is about 10^40, at 10^30 I'm at 50s and I didn't bother testing more).
n could be other than 10^N (e.g. n = 12563) makes me use a second algorithm
The extra "module 10^9 + 1" is just a diversion. In the range of n <= 10^100 they are just perfect squares (the next one is 14122 = 31623^2 module 10^9 + 1 but it has at least 175 digits).
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #171: Finding numbers for which the sum of the squares of the digits is a square
You are viewing a single comment's thread. Return to all comments →
This is much harder than the original question. I can solve the original question in 3 seconds (Python 3), but the following changes make it much much harder:
The extra "module 10^9 + 1" is just a diversion. In the range of n <= 10^100 they are just perfect squares (the next one is 14122 = 31623^2 module 10^9 + 1 but it has at least 175 digits).