Problem

Source: JBMO Shortlist 2007 N4

Tags: JBMO, number theory, remainder



Let $a, b$ be two co-prime positive integers. A number is called good if it can be written in the form $ax + by$ for non-negative integers $x, y$. Define the function $f : Z\to Z $as $f(n) = n - n_a - n_b$, where $s_t$ represents the remainder of $s$ upon division by $t$. Show that an integer $n$ is good if and only if the infinite sequence $n, f(n), f(f(n)), ...$ contains only non-negative integers.