\(\dfrac{n-17}{n+23}=\dfrac{n+23-40}{n+23}=1-\dfrac{40}{n+23}\)

\(\Rightarrow\left\{{}\begin{matrix}40⋮\left(n+23\right)\\n+23\ge23\left(n\ge0\right)\end{matrix}\right.\)

\(\Leftrightarrow\left\{{}\begin{matrix}\left(n+23\right)\in\left\{1;2;4;5;8;10;20;40\right\}\\n+23\ge23\end{matrix}\right.\)

\(\Leftrightarrow n+23=40\Leftrightarrow n=17\)