The phrase "neon number" is sometimes used for a number where: square the number, add the digits of that in base 10, and you get the original number.

So, 9 is a neon number (-> 81, 8+1, 9)

Indeed it is usually said there are only three neon numbers (0, 1, and 9).

Surprisingly I couldn't google any proof of this. (All the numbers up to a few billion have been trivially tested.)

Is there a proof?

And angularly, are "neon numbers" of any value or interest at all, or is it just a quirky thing?

  • 1
    $\begingroup$ Pretty sure that for any base $n$, the sum of the digits of $(n-1)^2$ in that base equals $n-1$. For example, in base $8$, $7\times 7=61$, and in hexadecimal, F$\times$F$=$E$1$ $\endgroup$ Sep 16 '21 at 5:32

Suppose a number $m$ has $n$ digits. Then $m^2$ has atmost $2n$ digits.
The sum of digits of $m^2$ is at most $9\times 2n=18n$.
If the sum of digits of $m^2$ is equal to $m$ then $10^{n-1}\le m\le18n$.
This only true if $n<3$, so only single digit and double digit numbers can possibly be neon numbers.

You can prove using modular arithmetic that only numbers of the form $9k$ and $9k+1$ can be neon numbers. This reduces the number of positive integers that we have to check.

Like @JBentley pointed out in the comments $0$ has to be considered separately because the inequality $10^{n-1}\le m$ does not hold.

  • 1
    $\begingroup$ so sober !!! thx! $\endgroup$
    – Fattie
    Sep 15 '21 at 19:27
  • 1
    $\begingroup$ +1 although your inequality doesn't cover the case where m=0 $\endgroup$
    – JBentley
    Sep 16 '21 at 5:34
  • $\begingroup$ @JBentley Unless you regard zero as having zero digits. Informally, we ignore leading zeroes (1 could be written as 0001 but still only has one digit; so 0 should be an empty string, but then we wouldn't see it!) More formally, if we use "successor of" notation, zero is 0, one is S0 etc. and so "number of digits" becomes "number of Ss". $\endgroup$
    – TripeHound
    Sep 16 '21 at 6:01
  • $\begingroup$ @TripeHound even if we accept that reasoning the inequality still doesn't work for the case where m=0 and n=0. The correct approach is simply to state the case for 0 as an exception. $\endgroup$
    – JBentley
    Sep 16 '21 at 6:05
  • 1
    $\begingroup$ @fattie Exception was a poor choice of word from me. Rather, it is a corner case which is part of the proof. It could have alternatively been stated as "If the sum of digits of m^2 is equal to m then either m=0 or 10^n−1 ≤ m ≤18n." $\endgroup$
    – JBentley
    Sep 16 '21 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.