Define the sequence of integers $a_1, a_2, a_3, \ldots$ by $a_1 = 1$, and \[ a_{n+1} = \left(n+1-\gcd(a_n,n) \right) \times a_n \]for all integers $n \ge 1$. Prove that $\frac{a_{n+1}}{a_n}=n$ if and only if $n$ is prime or $n=1$. Here $\gcd(s,t)$ denotes the greatest common divisor of $s$ and $t$.
Problem
Source: 2021 Simon Marais, A2
Tags: Sequence, number theory, greatest common divisor
09.11.2021 17:26
We prove by induction on $n$ that the set of prime divisors of $a_n$ is exactly the set of prime numbers strictly less than $n$. The claim is true for $n = 1$. Suppose that it is true for $n$ and we prove the case of $n + 1$. For one inclusion: the factor $(n + 1 - \gcd(a_n, n))$ is at most $n$, hence the prime divisors of $a_{n + 1}$ are all less than $n + 1$. To prove the other inclusion, we have two cases. If $n$ is not prime, then any prime number less than $n + 1$ is also less than $n$, thus is already prime divisor of $a_n$, and hence prime divisor of $a_{n + 1}$. If $n$ is prime, then we have $\gcd(a_n, n) = 1$ because all prime divisors of $a_n$ are less than $n$. Therefore $a_{n + 1} = na_n$ and the claim is clearly true. We have proved the claim for all $n$ and the original question is a byproduct of our proof.
26.11.2021 23:38
The main claim is that: When $n$ is prime then $\gcd(n,a_n)=1$,which in turn shows $a_{p+1}=p a_p$ for all prime $p$ When $n$ is composite then $\gcd(a_n,n)>1$ Proof. For prime $p$, $$a_p=\prod_{i=1}^{p-1} (i+1-\gcd(i,a_i))$$Since each factor is less than $p$ so $ p\nmid a_p$. For the second statement notice that $a_n|a_{n+1}$ which implies $a_m|a_n,\forall m\le n$.Let $p$ be a prime divisior of $n$,(so $p<n$).Then $pa_p=a_{p+1}|a_n$.But this shows $p|\gcd(n,a_n)\implies 1<p\le \gcd(n,a_n)$. $\square$ So for composite $n$ we have $\frac{a_{n+1}}{a_n}=n+1-\gcd(a_n,n)<n$.And when $n$ is prime or 1 then, $\frac{a_{n+1}}{a_n}=n$. $\blacksquare$