MathDB
n -> (sum of digits (n^2) ) + 1, repeat

Source: Portugal OPM 1999 p4

May 18, 2024
number theorysum of digits

Problem Statement

Given a number, we calculate its square and add 11 to the sum of the digits in this square, obtaining a new number. If we start with the number 77 we will obtain, in the first step, the number 1+(4+9)=141+(4+9)=14, since 72=497^2 = 49. What number will we obtain in the 19991999th step?