Define the sequence of integers a1,a2,a3,… by a1=1, and
an+1=(n+1−gcd(an,n))×an
for all integers n≥1.
Prove that anan+1=n if and only if n is prime or n=1.
Here gcd(s,t) denotes the greatest common divisor of s and t.
Sequencenumber theorygreatest common divisor