121212 ... 121 (mod 121) = ? Number of digits in the number - 67. Need someone to verify my answer.
I got an answer of 12. Is it right?
\[\large \underbrace{121212\ldots 121}_{\text{number of digits = 67}} \pmod {121} = \ ? \]
I solved it in a way that is described there: http://www.devx.com/tips/Tip/39012
What did you get?
12. Is it right?
No, numerically not even close. I have not gone through the method. Would you be kind enough to show the calculations according to the method, so we can all learn from you together?
is this supposed to be a programming or math question ?
Math. The way works perfectly with just human brain.
= below will be to show that it's congruent 121 = 0 (mod 121) Let's subtract 12100...000 (64 zeros) and take mod of it, it will be equal to 0. Let's continue with that. We get a number like this: 200020002000...2000 (64 digits) 2000 = 64 (mod 121) We get a number 64646464...64 (32 digits) with similar method we do that to get congruency to 51, 69, 72 and then 12.
I was interested, if it would really work. That's why I asked the question. ;)
This looks like a mix of chinese remainder theorem and some other stuff
Well, I have no idea about Chinese remainder theorem, will take a look into it later. Would anyone confirm if my answer might be true? If it's not, please tell me the right answer :)
Suppose you need to find n (mod a) and n is very big number: Take a manageable portion (say, x) of the input large number (n) and subtract it from n (n = n - x). Compute the mod of x (x (mod a)). Add the mod to n (n = n + x (mod a)). This way, the number n can be reduced without affecting the actual answer.
Is it right?
200020002000...2000 (64 digits) 2000 = 64 (mod 121) We get a number \(\color{red}{64646464...64 (32 digits) }\) it would be actually "0064006400640064006400640064006400640064006400640064006400640064", 64 digits. Up to here it still works. The mod is still 89.
Thank you!
Yes, the methods sounds interesting, and it remains a good tool! Thank you for sharing! :)
Post-script: According to the method, you only have to iterate 16 times x=mod(x*10000+0064,121), as follows: [x:0],for i:1 thru 16 do (x:mod(x*10000+64,121),print(x)); 64 95 93 58 111 10 118 72 114 2 99 42 73 71 36 89 (mod of original number) This method allows finding mod of large numbers in small chunks to fit in the limited memory of most binary calculators. But your application is very relevant, because it is then a simple iteration, as shown above.
Thank you for showing this to me, @mathmate !
You're welcome! :) I did so because I found that the method actually works, and would like to share with everyone!
Join our real-time social learning platform and learn together with your friends!