For each positive integer n, let S(n) be the sum of the digits of n2+1. A sequence {an} is defined, with a0 an arbitrary positive integer and an+1=S(an). Prove that the sequence {an} is eventually periodic with period three. number theorysum of digitsPeriodic sequenceperiodic