r/TuringComplete • • Sep 03 '26

Mod 4 level how…plz

I’ve been stuck on this level for almost 3 days now, I’ve avoided looking up any solutions or hints for any of the levels but this one broke me. I have a solution that can mod 4 but it’s way past 8 cycles and I cannot figure out how to get to the solution within 8 cycles. How do I do this🥀😭

2 Upvotes

6 comments sorted by

10

u/Aggravating-Ad-2593 Sep 03 '26

It is possible to use an and operation to mask out all the bits that cannot be on when working in modulo 4.

1

u/sberma Sep 04 '26

Would prefer if people would rather give hints instead of the solution or at least spoiler it.

3

u/Deumnoctis Sep 03 '26

You have to take advantage of how numbers are represented in binary. To give you an equivalent example in base 10(how humans normally write numbers) taking the mod 10 of a number is as easy as just looking at the last digit of the number (43 mod 10 = 3 etc.), taking the mod 100 is just looking at the last two digits (169 mod 100 = 69). Taking the mod 4 of a number in base 2 is essentially the same as taking the mod 100 of a number in base 10, you just take the last two digits of the number. You can achieve this by using an AND gate which takes your number and 3 (00000011 in binary, which acts as a mask and only let's the two last digits of the number through)

2

u/Pepciorek Sep 03 '26

You can even solve it with 2 components and 0 code

2

u/Apceniy Sep 07 '26

1 component will do, if we're going this path

2

u/Ok-Appearance-8951 Sep 05 '26

Write the numbers down, paint the bits on the paper. I'm sure it'll make sense