Difference between revisions of "2019 OIM Problems/Problem 1"

(Created page with "== Problem == For each positive integer <math>n</math>, let <math>s(n)</math> be the sum of the squares of the digits of <math>n</math>. For example, <math>s(15) = 1^2 + 5^2 =...")
 
 
Line 5: Line 5:
  
 
== Solution ==
 
== Solution ==
{{solution}}
+
Notice that if <math>n</math> has <math>d</math> digits, then <math>s(n)\le81d</math> (by setting <math>n=\overline{999\dots999}</math>). Using this, we can easily show that the only possible values of <math>d</math> are <math>d=1,2,3</math> since any greater would cause <math>81d<10^d</math>, so the maximum value of <math>s(n)</math> will always be less than the least possible value of <math>n</math>; thus <math>s(n)\ne n</math>.\\
 +
 
 +
Thus, we attempt casework on <math>d</math>. The case <math>d=1</math> is trivial; only <math>n=1</math> is a solution. Next, for <math>d=2</math>, we can show that the tens digit must always be even by considering parity of the ones digit versus parity of <math>s(n)</math>. Then, we can perform casework on the tens digit, which results in no solutions for this case.
 +
 
 +
Finally, we consider <math>d=3</math>. The maximum of <math>s(n)</math> here is <math>9^2\cdot3=243</math>, so we can divide our work down. If the hundreds digit is <math>2</math>, then the maximum becomes <math>2^2+9^2+9^2=166<200</math>, so the hundreds digit must be <math>1</math>. Then we can perform casework on ones digit parity to show that the tens digit is always odd. Furthermore, the maximum in this case is <math>1^2+9^2+9^2=163</math>, so we only need to test the tens digit equal to <math>1,3,5</math>. These efforts result in no solutions, so <math>\boxed{n=1}</math> is the only solution, which clearly works.
 +
 
 +
~ [https://artofproblemsolving.com/wiki/index.php/User:Eevee9406 eevee9406]
  
 
== See also ==
 
== See also ==
 
[[OIM Problems and Solutions]]
 
[[OIM Problems and Solutions]]

Latest revision as of 23:17, 19 March 2025

Problem

For each positive integer $n$, let $s(n)$ be the sum of the squares of the digits of $n$. For example, $s(15) = 1^2 + 5^2 = 26$. Find all integers $n \ge 1$ such that $s(n) = n$.

~translated into English by Tomas Diaz. ~orders@tomasdiaz.com

Solution

Notice that if $n$ has $d$ digits, then $s(n)\le81d$ (by setting $n=\overline{999\dots999}$). Using this, we can easily show that the only possible values of $d$ are $d=1,2,3$ since any greater would cause $81d<10^d$, so the maximum value of $s(n)$ will always be less than the least possible value of $n$; thus $s(n)\ne n$.\\

Thus, we attempt casework on $d$. The case $d=1$ is trivial; only $n=1$ is a solution. Next, for $d=2$, we can show that the tens digit must always be even by considering parity of the ones digit versus parity of $s(n)$. Then, we can perform casework on the tens digit, which results in no solutions for this case.

Finally, we consider $d=3$. The maximum of $s(n)$ here is $9^2\cdot3=243$, so we can divide our work down. If the hundreds digit is $2$, then the maximum becomes $2^2+9^2+9^2=166<200$, so the hundreds digit must be $1$. Then we can perform casework on ones digit parity to show that the tens digit is always odd. Furthermore, the maximum in this case is $1^2+9^2+9^2=163$, so we only need to test the tens digit equal to $1,3,5$. These efforts result in no solutions, so $\boxed{n=1}$ is the only solution, which clearly works.

~ eevee9406

See also

OIM Problems and Solutions