Problem

Source: Mexico National Olympiad 2015 Problem 4

Tags: number theory, combinatorics



Let $n$ be a positive integer. Mary writes the $n^3$ triples of not necessarily distinct integers, each between $1$ and $n$ inclusive on a board. Afterwards, she finds the greatest (possibly more than one), and erases the rest. For example, in the triple $(1, 3, 4)$ she erases the numbers 1 and 3, and in the triple $(1, 2, 2)$ she erases only the number 1, Show after finishing this process, the amount of remaining numbers on the board cannot be a perfect square.