This question was asked in Example 1
Show that one and only one out of n,n 2 or n 4 is divisible by 3, where n is any positive integer.

Leela vathi R's image