0

A positive integer $n$ is defined to be evil if the number of ones in its binary expansion is even, otherwise it is odious. Now define the function $$ \begin{equation*} t(n)= \begin{cases} 1 \rm{ \ if \ n \ is \ evil, } \\ 0 \rm{ \ if \ n \ is \ odious. } \\ \end{cases} \end{equation*} $$ The sequence associated with the function $t(n)$ is often referred to as the Thue-Morse sequence.

What is the best/most efficient way to write the function $t(n)$ in Mathematica?

Klangen
  • 1,009
  • 5
  • 14

0 Answers0