Allow me to explain and give examples of something I've been playing around with.
Let $A$ be the $n+1$ tuple of the form $(0, 1, 2, \ldots, n)$. Let $k = n + 1$ be the number of elements.
My question is: is there a tuple $B$ which is a permutation of $A$ that when you multiply element-wise $AB \bmod k$ you get a binary tuple e.g. each element of the tuple $e_i \in \{0,1\}$?
An example is take $$A = (0,1,2), B = (0,1,2)$$ Then $$AB\bmod 3 = (0\cdot0, 1\cdot1, 2\cdot2) \bmod3 = (0, 1, 1)$$ since $0\cdot0 = 0\bmod3, 1\cdot1 = 1\bmod3, 2\cdot2=1\bmod3$. Then this $B$ is a possible solution. Note that $$B = (0,2,1)$$ is not a solution since $$AB\mod{3} = (0\cdot0, 1\cdot2, 2\cdot1)\bmod3 = (0, 2, 2).$$ I have found that up to $k=9$ there is always a permutation. The amount of permutations vary and this is what I have so far for each $k$ using a brute force program:
$$1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 4, 7: 7, 8: 4, 9: 18.$$
An example solution for $k=9$ is to take the permutation $$A = (0,1,2,3,4,5,6,7,8), B = (1, 0, 5, 6, 7, 2, 3, 4, 8)$$ which results in $$AB\mod{9} = (0,0,1,0,1,1,0,1,1).$$
There are some things I can immediately see such as any element can work in the 0th place since it will be multiplied by 0. Whereas only 0 and 1 work in the 1st place. Finding the 0s will happen when $ab\mid k$ and the 1s when $ab$ is coprime to $k$.
What I do not know and would love help on is:
- Is there always a permutation that works for any $k > 9$?
- Is there a way to find the number of permutations possible for each $k$? Like a formula to describe the sequence of permutation counts?
- Is there a way to generate a permutation without brute force?