I am trying to write a function, that given these pairs: (10, 20), (1, 31), (2, 32), (13, 23), (4, 14), (5, 25), (16, 26), (7, 17), (8, 28), (19, 29) if I input one number of the pair the answer = 1 (i.e. half are in one set), and if I put in the other number, the answer = 0 (i.e. half are in another set). So for example, 10 = 0 and 20 = 1 OR vice versa. But both numbers of the pair cannot both equal the same number.
I'm having a lot of trouble finding a distinguishing characteristic. I've tried things like:
0 if > 10 or < 20, 1 otherwise
0 if mod 3 is odd, 1 if mod 3 is even
etc. and more. But I am really struggling. Can anyone help?
That's a small enough set that one could define a function $\,f\,$ by cases for each value. But, assuming the question is looking for some sort of a closed form solution, the following will return $\,0\,$ for the first number in each pair, and non-$0\,$ otherwise:
$$ f(n) = \big(n \bmod 10 \big) + 10 \cdot \bigg(1 - \Big( \big((n \bmod 10) \bmod 3\big)^2 \bmod 3 \Big) \bigg) - n $$
This is based on the observation that the tens digit of the first number in each pair is $\,\color{red}{1}\,$ iff the units digit $\,n \bmod 10\,$ is a multiple of $\,3\,$ i.e. $\,\color{blue}{0},\color{blue}{3},\color{blue}{6},\color{blue}{9}\,$.