Re: Square roots: corrected puzzle



Mark Brader:
What is the largest integer whose square root is equal to the sum of
its digits?

Richard Heathfield:
When we add 1 to n, n*2 increases by 2n + 1. The digital sum increases by
*at most* (number of digits in n-squared + 1) * 9. (Adding 1 to n never
increases the digit count of the square by more than 1.)

So when 2n + 1 exceeds (number-of-digits-in-n-squared+1) * 9, we have our
upper bound. This happens at n=18.

Good! That's better than what I had in mind for the cutoff, which was
to observe that for a number of 5 or more digits the digital sum must be
less than the square root, and for a 4-digit number the highest possible
digital sum is 36, whose square is 1296, whose digital sum is only 18.
So I put the upper bound at n = 35.

Inspection shows that there are two positive solutions (in base ten) for n
<= 18, the trivial 1, and 9 * 9 = 81, 8 + 1 = 9.

There was no requirement for solutions to be positive, but of course if
n = 1 works, the fact that n = 0 is irrelevant.

With fewer values to cover than I needed to, Richard has allowed himself
to consider 18 cases. The solution I had in mind was to observe that
the digital sum is always congruent mod 9 to the original number, so we
must have n = n^2 mod 9, and therefore (n = 0 or n = 1) mod 9. So only
the four values n = 1, 9, 10, 18 (and with my weaker bound also 19, 27,
and 28) need be considered, and as Richard says:

So n=9 is the highest solution possible.

Except that I asked for n^2, so the actual answer is 81.
--
Mark Brader | "I had never thought of Jesus as being
msb@xxxxxxx | a variety of grape plant, but
Toronto | if you put it that way..." --Jan Sand

My text in this article is in the public domain.
.



Relevant Pages