LMD Async Tutoring

This is my working. In it I happen upon a remainder solution to xor. I’m still stuck on a remainder solution to or though.

1 % 5 = 1
2 % 5 = 2
3 % 5 = 3
4 % 5 = 4
5 % 5 = 0

I want to map:

0 → 0
1 → 1
2 → 1

5 % 1 = 0
5 % 2 = 1
5 % 3 = 2
5 % 4 = 1
5 % 6 = 5
5 % 7 = 5
5 % 8 = 5

6 % 1 = 0
6 % 2 = 0
6 % 3 = 0
6 % 4 = 2
6 % 5 = 1
6 % 6 = 0
6 % 7 = 6

3 % 1 = 0
3 % 2 = 1
3 % 3 = 0
3 % 4 = 3

So a first number mod a second and larger number outputs the first number

5 % 1 = 0
6 % 2 = 0
7 % 3 = 1
8 % 4 = 0
9 % 5 = 4
10 % 6 = 4
11 % 8 = 3

3 % 1 = 0
4 % 1 = 0

0 % 2 = 0
1 % 2 = 1
2 % 2 = 0
3 % 2 = 1
4 % 2 = 0
5 % 2 = 1
6 % 2 = 0
7 % 2 = 1
8 % 2 = 0
9 % 2 = 1

Okay so using ‘% 2’ can check if something is even or odd. That means you could use it for xor.

xor(x, y) = (x + y) % 2

Okay, so I am conceptually trying to do the same thing as with division. Mapping 0 to 0, and 1 and 2 to 1. The hint was to try n/10. That made me see that anything under 10 output 0 and anything above output 1. So I want a way that I can use remainder do the same thing. Can I use remainder to check primes? I know that 1 and 2 are both primes. if there was a prime check function called ‘prime’ that output true when prime, i could do:

0 prime 0
1 prime 1
2 prime 1

When is something a prime? When it has no factors except 1 and itself. I think I would maybe need to recursively check that each number below the input wasn’t a factor though. What other things maps 0, 1, 2 to 0, 1, 1?

A remainder function subtracts the second number from the first number until it cant and then returns the remainder.

If i could multiply 0, 1, 2 by something, that would spread them out across the number line, keeping 0 at 0. But they’re then all scaled by the same amount.

Hmm. Stuck for now.