40 Find the smallest positive integer $n$ such that the indeterminate equation
$$n=x^{3}-x^{2} y+y^{2}+x-y$$

has no positive integer solutions.
40. Let $F(x, y)=x^{3}-x^{2} y+y^{2}+x-y$, then $F(1,1)=1, F(1,2)=2$.

Therefore, when $n=1,2$, the equation has positive integer solutions.
Next, we prove that $F(x, y)=3$ has no positive integer solutions.
Consider the equation $F(x, y)=3$ as a quadratic equation in $y$
$$y^{2}-\left(x^{2}+1\right) y+x^{3}+x-3=0$$

If there exist positive integer solutions, then
$$\Delta=\left(x^{2}+1\right)^{2}-4\left(x^{3}+x-3\right)=x^{4}-4 x^{3}+2 x^{2}-4 x+13$$

must be a perfect square.
Notice that, when $x \geqslant 2$, we have $\Delta < (x^{2}-2 x-2)^{2}$, so when $x \geqslant 6$, $\Delta$ is not a perfect square. And when $x=1,2,3,4,5$, the corresponding $\Delta=8,-3,-8,29,168$ are not perfect squares, hence there are no positive integer solutions when $n=3$.

In summary, the smallest positive integer $n=3$.