01-29-2014, 10:24 PM
(This post was last modified: 01-30-2014, 03:00 AM by Killerbunny.)
x/10 = (x/2)/5) so your rest is equal to (x/2)mod 5 = R/2 where (R/2 < 5)
or X mod 10 = R where (R < 10 )
R = rest
Mod = moduler arithmatic
I am not sure if this helps or not but if you want help search for modular arithmetic.
Edit-
So I had an idea that might be noteworthy. As we know
R=1, 2, 3, 4, 5, 6, 7, 8, 9
If X mod 2 = 1
Then R mod 2 = 1
If R mod 2 = 1
Then R = 1,3,5,7,9
Else R = 0,2,4,6,8
Meaning we can reduce our search down to 5 just by checking the one bit.
I think it is possible to reduce this number even further, but I'm not exactly sure how. I think it has to do with mod 4 or 5.
or X mod 10 = R where (R < 10 )
R = rest
Mod = moduler arithmatic
I am not sure if this helps or not but if you want help search for modular arithmetic.
Edit-
So I had an idea that might be noteworthy. As we know
R=1, 2, 3, 4, 5, 6, 7, 8, 9
If X mod 2 = 1
Then R mod 2 = 1
If R mod 2 = 1
Then R = 1,3,5,7,9
Else R = 0,2,4,6,8
Meaning we can reduce our search down to 5 just by checking the one bit.
I think it is possible to reduce this number even further, but I'm not exactly sure how. I think it has to do with mod 4 or 5.