22. N4 (BUL) Find all positive integers \(a\) and \(b\) for which 
\[ \left[\frac{a^{2}}{b}\right]+\left[\frac{b^{2}}{a}\right]=\left[\frac{a^{2}+b^{2}}{a b}\right]+a b \]
where as usual, \([t]\) refers to greatest integer that is less than or equal to \(t\).
22. Let \(a, b \in \mathbb{N}\) satisfy the given equation. It is not possible that \(a=b\) (since it leads to \(a^{2}+2=2a\)), so we assume w.l.o.g. that \(a > b\). Next, for \(a > b = 1\) the equation becomes \(a^{2} = 2a\), and one obtains a solution \((a, b) = (2, 1)\). Let \(b > 1\). If \(\left[\frac{a^{2}}{b}\right] = \alpha\) and \(\left[\frac{b^{2}}{a}\right] = \beta\), then we trivially have \(ab \geq \alpha \beta\). Since also \(\frac{a^{2} + b^{2}}{ab} \geq 2\), we obtain \(\alpha + \beta \geq \alpha \beta + 2\), or equivalently \((\alpha - 1)(\beta - 1) \leq -1\). But \(\alpha \geq 1\), and therefore \(\beta = 0\). It follows that \(a > b^{2}\), i.e., \(a = b^{2} + c\) for some \(c > 0\). Now the given equation becomes \(b^{3} + 2bc + \left[\frac{c^{2}}{b}\right] = \left[\frac{b^{4} + 2b^{2}c + b^{2} + c^{2}}{b^{3} + bc}\right] + b^{3} + bc\), which reduces to 
\[ (c-1)b + \left[\frac{c^{2}}{b}\right] = \left[\frac{b^{2}(c+1) + c^{2}}{b^{3} + bc}\right] \]
If \(c = 1\), then (1) always holds, since both sides are 0. We obtain a family of solutions \((a, b) = (n, n^{2} + 1)\) or \((a, b) = (n^{2} + 1, n)\). Note that the solution \((1, 2)\) found earlier is obtained for \(n = 1\). If \(c > 1\), then (1) implies that \(\frac{b^{2}(c+1) + c^{2}}{b^{3} + bc} \geq (c-1)b\). This simplifies to 
\[ c^{2}(b^{2} - 1) + b^{2}(c(b^{2} - 2) - (b^{2} + 1)) \leq 0 \]
Since \(c \geq 2\) and \(b^{2} - 2 \geq 0\), the only possibility is \(b = 2\). But then (2) becomes \(3c^{2} + 8c - 20 \leq 0\), which does not hold for \(c \geq 2\). Hence the only solutions are \((n, n^{2} + 1)\) and \((n^{2} + 1, n)\), \(n \in \mathbb{N}\).