How many functions $f: B\to B$ map even numbers to even numbers if $B=\{5,2,7,4,9,6\}$?
Because there's a requirement to map even numbers to even numbers then the domain and the range of $f$ is $B'=\{2,4,6\}$ as far as I understand. Then the number of possible functions is $|B'|^{|B'|}=3^3$.
Not sure regarding the correct answer.
The condition to be satisfied for $f:B\to B$ (so the domain is $B$ and not $B'$) is that $f(B')\subseteq B'$. Since there are no constraints on the image of odd numbers, the number of such functions should be $$\underbrace{|B|^{|B|-|B'|}}_{\text{image of odd numbers}}\cdot \underbrace{|B'|^{|B'|}}_{\text{image of even numbers}}=6^3\cdot 3^3.$$