Solution:
Let a be Ian's age. Then
p(x)=(x−a)q(x)
where q(x) is a polynomial with integer coefficients.
Since p(7)=77, we have
p(7)=(7−a)q(7)=77=7⋅11
Since q(7) is an integer and 7−a<0, we restrict
a−7∈{1,7,11,77}
Let b be the second number mentioned by Marco. Since p(b)=85, we have
p(b)=(b−a)q(b)=85=5⋅17
Since q(b) is an integer and b−a<0, we restrict
a−b∈{1,5,17,85}
Finally, we know from algebra that b−7 is a divisor of p(b)−p(7)=85−77=8=23. It follows that
b−7∈{1,2,4,8}
Considering all the possibilities from (⋆⋆) and (⋆⋆⋆), since a−7=(a−b)+(b−7), we get
a−7∈{2,3,5,6,7,9,13,18,19,21,25,86,87,89,93}
Recalling (⋆), we get a−7=7 or a=14.