4
$\begingroup$

A number is called special if its decimal value^ is the average of its digits. How many special numbers are there? Bonus: How many special numbers do not begin with the digit 0? Good luck!

^ You are allowed to append zeroes at the end. For example "1" is a special number, while "1.0" is not.

$\endgroup$
8
  • $\begingroup$ Are you saying that, for example, 0.200000000 is special? $\endgroup$
    – hexomino
    Sep 23, 2023 at 10:01
  • $\begingroup$ @hexomino that's right! $\endgroup$ Sep 23, 2023 at 10:20
  • 1
    $\begingroup$ I feel like the bonus is the real interesting question here. As the answers demonstrate, the original is borderline trivial. Would also be interesting to see what happens if we exclude trailing zeroes. $\endgroup$
    – hexomino
    Sep 23, 2023 at 10:37
  • 4
    $\begingroup$ What would be really interesting is any rational numbers with an infinitely repeating decimal expansion that would fit this rule $\endgroup$
    – mousetail
    Sep 23, 2023 at 11:29
  • 1
    $\begingroup$ @BenjaminWang: I suppose the average of the digits of any normal number (in the sense of the limit of the digit average as you take more & more digits) would have to be 9/2. And since 9/2 isn't normal, and "most" real numbers are normal, then any numbers with this property are very special indeed. $\endgroup$ Sep 25, 2023 at 18:55

4 Answers 4

8
$\begingroup$

For the bonus, single-digit integers are trivial.

Rational numbers greater than 1, with trailing zeros, include:

1.1250000 = 9/8
1.500 = 6/4
1.687500000000000 = 27/16
1.8000 = 9/5
2.250 = 9/4
3.750 = 15/4

And this one is very special, having no trailing zeros.

4.5 = 9/2

$\endgroup$
4
  • $\begingroup$ Nice work! These are all that I found, including one extra (third one). Are there any more? $\endgroup$ Sep 23, 2023 at 13:25
  • $\begingroup$ I found the same ones. I don't think there are any others of finite length, cause with longer numbers you get a larger proportion of trailing zeroes, bringing the average of the digits to below 1. $\endgroup$ Sep 23, 2023 at 14:20
  • 3
    $\begingroup$ The numerators are all divisible by 3. Interesting. $\endgroup$ Sep 23, 2023 at 15:08
  • $\begingroup$ @BenjaminWang yes, it's possible to show that (in any special number) the sum of digits must be a multiple of 3 unless the number of digits is 1 mod 9. So a special number with digit sum not divisible by 3 has either 10 digits or at least 64 digits, and therefore has too many zeroes to be above 1. $\endgroup$ Sep 26, 2023 at 11:38
8
$\begingroup$

There

are an infinite number of special numbers,

because

0.1...0 (total 10 digits), 0.01...0 (total 100 digits), and so on all work.

For the bonus part, I found

1, 2, ..., 9, and...

If you allow infinite decimals, we have 8.999... recurring.

$\endgroup$
3
  • $\begingroup$ There are more special numbers that do not begin with 0 $\endgroup$ Sep 23, 2023 at 10:52
  • $\begingroup$ Yea I made a mistake in the bonus part. Will try again. $\endgroup$ Sep 23, 2023 at 10:54
  • 2
    $\begingroup$ nice find. There are more... $\endgroup$ Sep 23, 2023 at 11:38
7
$\begingroup$

There are

an infinite number of special numbers.

For example,

0, 0.0, 0.00, ...

$\endgroup$
2
  • 1
    $\begingroup$ but these are all the same number! $\endgroup$
    – univalence
    Sep 25, 2023 at 12:41
  • 1
    $\begingroup$ @univalence The question states, “For example "1" is a special number, while "1.0" is not.” So the appearance of a number (and not just its value) is important in this question. So 0, 0.0, 0.00, … are different special numbers. $\endgroup$ Sep 26, 2023 at 2:57
2
$\begingroup$

I wanted to try my hand at it from a principled way, by creating an equation for it.

The simple case of single digits is obvious, so let's start our equations with 2 digits of interest: ie, we are looking for (a, b, n) such that a.b0... = (a + b) / n.

a + b / 10 = (a + b) / n
<=> n . a + n . b / 10 = a + b
<=> (n - 1) . a = (1 - n / 10) . b
<=> a = b . (1 - n / 10) / (n - 1)

Now, we can attempt to solve the equation for various values of n:

We restrict ourselves to a and b in [1, 2, 3, 4, 5, 6, 7, 8, 9], as a = 0 or b = 0 are trivial cases.

- For n = 2 we get a = b . 4 / 5, and thus a = 4 and b = 5, that is: 4.5 = 9 / 2.
- For n = 3 we get a = b . 7 / 20, and no value of b will make up that 20.
- For n = 4 we get a = b / 5, and thus a = 1 and b = 5, that is: 1.500 = 6 / 4.
- For n = 5 we get a = b / 8, and thus a = 1 and b = 8, that is: 1.8000 = 9 / 5.
- For n = 6 we get a = b . 2 / 25, and no value of b will make up that 25.
- For n = 7 we get a = b / 20, and no value of b will make up that 20.
- For n = 8 we get a = b / 35, and no value of b will make up that 35.

Given the fact that the denominator will only grow from there, and that the quotient b / a cannot exceed 9, there's no point in looking any further.

As a recap, we have gathered the following solutions:

4.5 = 9 / 2, 1.500 = 6 / 4, and 1.8000 = 9 / 5.

We can similarly proceed with (a, b, c, n) such at a.bc0... = (a + b + c) / n.

a + b / 10 + c / 100 = (a + b + c) / n
<=> n . a + n . b / 10 + n . c / 100 = a + b + c
<=> (n - 1) . a = (1 - n / 10) . b + (1 - n / 100) . c
<=> a = (b . (1 - n / 10) + c . (1 - n / 100)) / (n - 1)

Which we can once again attempt to solve for various values of n:

We restrict ourselves to: - a and c being non-zero digits, otherwise we fall back to the previous study. - while b can be any digit. And from there: - For n = 3 we get a = (b . 70 + c . 97) / 200, and just looking at the digits of the numerator tells us there's no solution with c non-zero. - For n = 4 we get a = (b . 15 + c . 24) / 75, once again, looking at the digits of the numerator, we notice that there's no solution with c != 5. With c = 5, we find a = 2 and b = 2, that is: 2.250 = 9 / 4, as well as a = 3 and b = 7, that is 3.750 = 15 / 4.
- For n = 5 we get a = (b . 10 + c . 19) / 80, and just looking at the digits of the numerator tells us there's no solution with c non-zero.
- For n = 6 we get a = (b . 20 + c . 47) / 250, nope.
- For n = 7 we get a = (b . 10 + c . 31) / 200, nope.
- For n = 8 we get a = (b . 5 + c . 23) / 175, no solution with c != 5, and the denominator is too large for b to make it up when c = 5.
- For n = 9 we get a = (b . 10 + c . 91) / 800, nope. - For n = 10 we get a = c / 10, and the denominator has grown too large for c to make up.

As a recap, we have gathered the following solutions:

2.250 = 9 / 4, and 3.750 = 15 / 4.

Observation:

It seems that in a multi-digits solution, there cannot be a solution in which the smallest non-zero digit is not 5, as otherwise it doesn't add-up cleanly with the previous smallest digit.

Automating the search with Python does not yield any more results beyond:

- For 4 digits, we find for n = 8, a = 1, b = 1, c = 2, and d = 5, or 1.1250000 = 9 / 8.
- For 5 digits, we find 1.6875 = 27 / 16.

And I do wish I had a more principled explanation for this.


Program:

    from fractions import Fraction

def solve_rec(n, n_digits): def rec(n, den, fac, digits, acc): if den == fac: denominator = den * (n - 1)
if acc <= 0 or acc % denominator != 0: return
a = acc // denominator
digits = [a] + digits
print("n = ", n, ", list = ", digits, ", fraction =", sum(digits), "/", n) return
numerator = den - fac * n
for digit in range(0, 10): new_acc = acc + digit * numerator
if new_acc % (fac * 10) != 0: continue
rec(n, den, fac * 10, [digit] + digits, new_acc)
last_numerator = 10 ** n_digits - n
for last in range(1, 10): accumulator = last * last_numerator
if accumulator % 10 != 0: continue
rec(n, 10 ** n_digits, 10, [last], accumulator)

if name == 'main': import sys
limit = int(sys.argv[1])
for n_digits in range(1, 10): for n in range(n_digits + 1, limit + 1): solve_rec(n, n_digits)

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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