To unlock his cell phone, Joao slides his finger horizontally or vertically across a numerical box, similar to the one represented in the figure, describing a $7$-digit code, without ever passing through the same digit twice. For example, to indicate the code $1452369$, Joao follows the path indicated in the figure. João forgot his code, but he remembers that it is divisible by $9$. How many codes are there under these conditions?
2016 Portugal MO
Day 1
In how many different ways can you write $2016$ as the sum of a sequence of consecutive natural numbers?
Let $[ABC]$ be an equilateral triangle on the side $1$. Determine the length of the smallest segment $[DE]$, where $D$ and $E$ are on the sides of the triangle, which divides $[ABC]$ into two figures with equal area.
Day 2
Let $[ABCD]$ be a parallelogram with $AB <BC$ and let $E, F$ be points on the circle that passes through $A, B$ and $C$ such that $DE$ and $DF$ are tangents to this circle. Knowing that $\angle ADE = \angle CDF$ , determine $\angle ABC$.
Determine all natural numbers $x, y$ and $z$ such that the number $2^x +4^y +8^z +16^2$ is a power of $2$.
The natural numbers are colored green or blue so that: $\bullet$ The sum of a green and a blue is blue; $\bullet$ The product of a green and a blue is green. How many ways are there to color the natural numbers with these rules, so that $462$ are blue and $2016$ are green?