I have
let f = x => x % 4 === 0 ? 0 : 4 - x % 4
But this is a piece of garbage function. Reference.
x will never be negative.
Here is a kind of truth table, or something like that.
x x % 4 4 - (x % 4) f(x)
0 0 4 0
1 1 3 3
2 2 2 2
3 3 1 1
4 0 4 0
5 1 3 3
6 2 2 2
7 3 1 1
8 0 4 0
9 1 3 3
I'm trying to find some correlations here, but it's late, and I don't think my brain is working properly. Zzz
What I see in the column f(x)is a kind of inverse module, resulting in loop outputs from 032103210 ... instead of 01230123 ...
I suggest that using Math.maxor Math.minin combination with Math.absmay help & hellip; Probably there x * -1somewhere & hellip;
Can you help me write fso that it does not suck so badly?