For positive integers n define d(n) = n - m^{2}, where m is the greatest integer with m^{2} ≤ n. Given a positive integer b_{0}, define a sequence b_{i} by taking b_{k+1} = b_{k} + d(b_{k}). For what b_{0} do we have b_{i} constant for sufficiently large i?

**Solution**

Easy.

Answer: the squares.

If b_{k} is a square, then d(b_{k}) = 0, so b_{k+1} = b_{k} and the sequence is constant from that point on.

If b_{k} is not a square, then for some m it lies between m^{2} and (m + 1)^{2}, so we can write it as m^{2} + r, where 1 ≤ r ≤ 2m. So b_{k+1} = m^{2} + 2r. But m^{2} < b_{k+1} < (m + 2)^{2} and b_{k+1} ≠ (m + 1)^{2}, so b_{k+1} is not a square (and is > b_{k}).

© John Scholes

jscholes@kalva.demon.co.uk

21 Sep 1999