Let S be the smallest set of positive integers such that
a) 2 is in S,
b) n is in S whenever n^2 is in S, and
c) (n + 5)^2 is in S whenever n is in S.
Which positive integers are not in S?
(The set S is “smallest” in the sense that S is contained in any other such set.)
Source: Putnam 2017