Using the property of polynomial that $a-b | p(a)- p(b)$ we have between N and 21
$N-21 | P(N) - p(21)$
As $P(N) = N+ 51$
We get $N-21 | N+ 51 - 17$
or $N-21 | N + 34| or | N - 21 |(N+ 34) - (N-21) $
or $N-21 | 55$
This gives N-21 = 1 or 5 or 11 or 55 or -1 or -5 or - 11 or -55
So N = 26 or 32 or 36 or 76 or 20 or 16 or 10 or - 34 (1)
Now with 32 we get $N- 32 | N + 51 - (-247)$ or $N-32 | 330$ (2)
Finally with 37 we get $N -37 | N + 51 - 33$ | or $N- 37 | 55$
from set of (1) we get 26 or 32 or 36
from above (3) values we get N = 26
so N = 26 is the answer