Prove that there is a finite number of values of n that satisfy
n = 4s(n) + 3s(s(n)) + 2s(s(s(n))) + 1
where n is a positive integer and s(n) denotes the sum of the digits of n. Also, determine analytically, all values of n that satisfy the equation.
The right hand side can't exceed 9*(4*(log(n)+1) + 3*(log(log(n)+1)+1) + 2*(log(log(log(n)+1)+1)+1) + 1). That upper bound is equal to n when n=189.1301139899085, and from then on n surpasses it, as this formula is logarithmic.
As for the values for which the original equation is satisfied, the program:
DECLARE FUNCTION s! (n!)
CLS
FOR n = 1 TO 100000
IF n = 4 * s(n) + 3 * s(s(n)) + 2 * s(s(s(n))) + 1 THEN
PRINT n
END IF
NEXT
FUNCTION s (n)
st$ = LTRIM$(STR$(n))
t = 0
FOR i = 1 TO LEN(st$)
t = t + VAL(MID$(st$, i, 1))
NEXT
s = t
END FUNCTION
finds 10 and 46 as the only two values of n that satisfy the equation.

Posted by Charlie
on 20070226 16:07:38 