TITLE: Let A be a square matrix of order $3$ with integer entries such that $\det(A)=1$.
QUESTION [8 upvotes]: What is the maximum possible number of entries of A that  are  even? What if A is a matrix of order n?
What is the maximum possible number of entries of A that  are  PRIMES? What if A is a matrix of order n?

This question was asked  during my class test and I was unable to do this.
Please help me in doing this.

REPLY [3 votes]: For first part answer is $6$. You cab take $A$ as $$A=\begin{bmatrix} 1&0&0\\b&a&ac-1\\d&1&c\end{bmatrix}$$ where $a,b,c,d$ are any even number. Now consider $$e_3=6,$$
$$e_4=e_3+2(4-1)$$
$$e_n=e_{n-1}+2(n-1)$$ where $e_n$ is no. of even entries when $A$ is of order $n\ge3$.
For second part take $A$ as $$A=\begin{bmatrix} 1&0&0\\a&p_1&p_2\\b&p_3&p_4\end{bmatrix}$$ where $a,b$ are any prime number and $p_1p_4-p_3p_2=1$ it is possible to find such primes e.g take $p_1=3,p_4=5,p_3=2,p_2=7$. Now consider $$p_3=6,$$
$$e_4=e_3+(4-1)$$
$$e_n=e_{n-1}+(n-1)$$ where $p_n$ is no. of prime entries when $A$ is of order $n\ge3$.