This is apparently the smallest divisor of gcd(n,a(n-1)) not yet used if such exists, or lcm(n,a(n-1)) otherwise. This is a permutation of the positive integers. The required lemma is that there are arbitrarily long sequences where a(n) = lcm(n,a(n-1)).