If \(\left\lfloor n^2/4 \right\rfloor - \lfloor n/2 \rfloor^2 = 2\), then find all integer values of $n$.
The only answer is 5. I did this by examining a table of values.
There is bound to be a more elegant way of doing it but I do not know what it is.
\(\left\lfloor n^2/4 \right\rfloor - \lfloor n/2 \rfloor^2 = 2\)
n | -10 | -9 | -8 | -7 | -6 | -5 | -4 | -3 | -2 | -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
\(\left\lfloor n^2/4 \right\rfloor \) | 25 | 20 | 16 | 12 | 9 | 6 | 4 | 2 | 1 | 0 | 0 | 0 | 1 | 2 | 4 | 6 | 9 | 12 | 16 | 20 | 25 |
\(\lfloor n/2 \rfloor^2\) | 25 | 25 | 16 | 16 | 9 | 9 | 4 | 4 | 1 | 1 | 0 | 0 | 1 | 1 | 4 | 4 | 9 | 9 | 16 | 16 | 25 |
\(\left\lfloor n^2/4 \right\rfloor - \lfloor n/2 \rfloor^2\) | 0 | -5 | 0 | -4 | 0 | -3 | 0 | -2 | 0 | -1 | 0 | 0 | 0 | 1 | 0 | 2 | 0 | 3 | 0 | 4 | 0 |
So I can see that for all even numbers, positive and negative the answer will be zero.
For the odd numbers a pattern emerges.
It is clear to me that the only integer value of n to make this true is 5