As $n+ S(n) = 2021$ so $n < 2021$.
Now highest $S(n)$ for number $n < 2021$ is 28 that is when
n = 1999.
so $ n >= 2021-28$ or $n>=1993$
Now working mod 9 we have $ n \equiv S(n) \pmod 9$
So $n + S(n) \equiv 2n \pmod 9$
so $2n \equiv 2021 \pmod 9$
or $2n \equiv 5 \pmod 9$
as 5 is odd add 9 to get even
so $2n \equiv 14 \pmod 9$
or $n \equiv 7 \pmod 9$
so we need to check for candidates between 1993 and 2021 which are 7 mod 9 and they are 1996, 2005,2014 out of which 1996 and 2014 satisfy the condition
No comments:
Post a Comment