01-30-2014, 08:25 PM
(This post was last modified: 01-30-2014, 10:11 PM by Killerbunny.)
If you look at the binary numbers numbers in decimal we see it follows a simple pattern in the one bits, witch are the ones you care about when performing X mod 10 . The pattern goes like this.
(1) 2 4 8 6 2 4 8 6
We add the corresponding values together, and do mod 10 on this value. In all I think it can be performed in 11 ticks if you use signal stregth to add these numbers. But maybe you can speed it up a bit more.
-Edit
I found a way to speed things up by using the formula X/2 mod 5 = R/2
So in our case X is equal to one of the values in the pattern ( (1) 2 4 8 6 ) by dividing eatch value by two ( so (1) 1 2 4 3) we can fit all four in one redstone line, and when all the numbers fit in one line we can easly performe mod 5.
To convert back we just multiply by two and add 1 if the one bit is on. In all I think we get a anwser in ca 8 or 9 ish ticks.
(1) 2 4 8 6 2 4 8 6
We add the corresponding values together, and do mod 10 on this value. In all I think it can be performed in 11 ticks if you use signal stregth to add these numbers. But maybe you can speed it up a bit more.
-Edit
I found a way to speed things up by using the formula X/2 mod 5 = R/2
So in our case X is equal to one of the values in the pattern ( (1) 2 4 8 6 ) by dividing eatch value by two ( so (1) 1 2 4 3) we can fit all four in one redstone line, and when all the numbers fit in one line we can easly performe mod 5.
To convert back we just multiply by two and add 1 if the one bit is on. In all I think we get a anwser in ca 8 or 9 ish ticks.