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.
You can get all the other testcases by ignoring the second fact and concentrating on the first. To get that last one you need to use the second fact. tsite's idea about lcm(2^20, 1000) is the same (note that lcm(2^20, 1000) = 125 * 2^20).
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
PRNG Sequence Guessing
You are viewing a single comment's thread. Return to all comments →
1000 = 125 * 8.
By the Chinese remainder theorem, if
X = Y (mod 1000),
then X = Y (mod 8)
and
X = Y (mod 125)
You can get all the other testcases by ignoring the second fact and concentrating on the first. To get that last one you need to use the second fact. tsite's idea about lcm(2^20, 1000) is the same (note that lcm(2^20, 1000) = 125 * 2^20).