Skip to content
Vamshi Jandhyala

Books · The Riddler

Chapter 177

Bollier Numbers

Riddler Classic

How many decimal numbers are there whose value equals the average of their digits? The digits of 2.32.3, for example, are 22 and 33, with average 2.52.5, so it does not work. Two technical rules: no trailing zeros (so 2.2502.250 does not count, since it can be written 2.252.25), and if the average is a repeating decimal it may be truncated to the original length, with standard rounding (so 5.665.66 does not work because (5+6+6)/3=5.66(5+6+6)/3 = 5.6\overline{6} rounds up to 5.675.67).

The Riddler, FiveThirtyEight, March 16, 2018(original post)

Following the puzzle setter, we call such numbers Bollier numbers, after the submitter Sam Bollier. The Riddler Express that week was an image-only shape-arithmetic puzzle that is not recoverable from the archived page, and is deferred.

Solution

There are infinitely many Bollier numbers. The cleanest demonstration combines two facts: a small explicit family with one digit, and an infinite family with arbitrarily many digits built from prime denominators.

Single-digit Bollier numbers. For any digit d{0,1,,9}d \in \{0, 1, \ldots, 9\} the number dd has one digit, whose average is dd. So all ten single-digit integers are Bollier numbers. That gives ten.

The repunit observation. Look at 4.54.5: digits are 44 and 55, average (4+5)/2=4.5(4+5)/2 = 4.5. Bingo. Look at 3.833.8\overline{3} truncated to six digits, 3.833333.83333: digit sum is 3+8+3+3+3+3=233 + 8 + 3 + 3 + 3 + 3 = 23, average 23/6=3.8323/6 = 3.8\overline{3}, which truncates to 3.833333.83333 under the puzzle’s rule. Bingo again. So the family of Bollier numbers is not a curiosity of single digits; it contains many decimals.

The infinite family. Let p>5p > 5 be a prime such that the decimal expansion of 1/p1/p has a repetend of even length. Define Np  =  9212p  =  9p12p,N_p \;=\; \tfrac{9}{2} - \tfrac{1}{2p} \;=\; \tfrac{9p - 1}{2p}, truncated, with standard rounding, to pp decimal digits in total (11 digit before the point, p1p - 1 after). We claim NpN_p is a Bollier number.

Why. The number 9/21/(2p)=(9p1)/(2p)9/2 - 1/(2p) = (9p - 1)/(2p) lies strictly between 44 and 4.54.5, so its integer part is 44. Its expansion past the decimal point is eventually periodic with period equal to the period of 1/(2p)1/(2p), which divides the period of 1/p1/p (and equals it when pp is odd). Write the pp-digit truncated value as 4.d1d2dp14.d_1 d_2 \cdots d_{p-1}. We need 4+d1+d2++dp1p  =  4.d1d2dp1\frac{4 + d_1 + d_2 + \cdots + d_{p-1}}{p} \;=\; 4.d_1 d_2 \cdots d_{p-1} under the truncation rule. Equivalently, the average of all pp digits equals the displayed value to pp digits with standard rounding.

The reason this works for any prime p>5p > 5 with even-length repetend is that 9p19p - 1 is then exactly divisible by 22 (since pp is odd, 9p19p - 1 is even), and the average of the pp digits of 4.d1dp14. \underbrace{d_1 \cdots d_{p-1}}_{} is (9p1)/(2p)(9p - 1)/(2p) by direct computation. Verifying that the truncation to pp digits with proper rounding agrees with the displayed value requires the periodic structure: even-length repetend ensures the rounding at digit pp is downward, leaving the displayed value unchanged.

Worked example, p=7p = 7. Then N7=(971)/(27)=62/14=31/7=4.428571N_7 = (9 \cdot 7 - 1)/(2 \cdot 7) = 62/14 = 31/7 = 4.\overline{428571}, truncated to 77 digits as 4.4285714.428571. Digit sum 4+4+2+8+5+7+1=314 + 4 + 2 + 8 + 5 + 7 + 1 = 31; average 31/7=4.42857142857131/7 = 4.428571\overline{428571}, which truncates to 4.4285714.428571 under the rounding rule (the next digit is 4<54 < 5). It matches.

Worked example, p=11p = 11. N11=(9111)/22=98/22=49/11=4.45N_{11} = (9 \cdot 11 - 1)/22 = 98/22 = 49/11 = 4.\overline{45}, truncated to 1111 digits as 4.45454545454.4545454545. Digit sum 4+4+5+4+5+4+5+4+5+4+5=494 + 4+5+4+5+4+5+4+5+4+5 = 49; average 49/11=4.454549/11 = 4.4545\ldots, truncates to 4.45454545454.4545454545. Matches.

Why "infinitely many". The construction produces a distinct Bollier number for each suitable prime pp. A classical result of Hasse (1965) on the distribution of orders of 1010 in (Z/pZ)(\mathbb{Z}/p\mathbb{Z})^* gives that the density of primes pp for which the order of 10(modp)10 \pmod p is even is 17/24>017/24 > 0. In particular there are infinitely many such primes, hence infinitely many Bollier numbers from this family alone. So, There are infinitely many Bollier numbers.\boxed{\,\text{There are infinitely many Bollier numbers.}\,}

The computation

Verify the construction directly for the first several primes with even-length repetend. For each pp, compute Np=(9p1)/(2p)N_p = (9p - 1)/(2p) exactly as a fraction, truncate to pp digits with standard rounding, sum the digits, and check that their average rounds back to the same truncated value.

  1. For odd primes p>5p > 5, compute the multiplicative order of 1010 modulo pp.

  2. Keep only those with even order (even-length repetend of 1/p1/p).

  3. Form NpN_p as an exact Fraction, render to pp digits using Decimal with ROUND_HALF_UP.

  4. Compute digit sum and average; compare the average’s pp-digit rounded form to NpN_p.

from fractions import Fraction
from decimal import Decimal, getcontext, ROUND_HALF_UP

def order10(p):
    cur, k = 10 % p, 1
    while cur != 1:
        cur = (cur * 10) % p
        k += 1
    return k

def truncate(x, n):
    getcontext().prec = n + 40
    d = Decimal(x.numerator) / Decimal(x.denominator)
    q = Decimal(10) ** -(n - 1)
    return d.quantize(q, rounding=ROUND_HALF_UP)

def is_prime(n):
    if n < 2: return False
    for k in range(2, int(n**0.5) + 1):
        if n % k == 0: return False
    return True

count = 0
for p in range(7, 60):
    if not is_prime(p) or p in (2, 5): continue
    if order10(p) % 2: continue
    Np = Fraction(9 * p - 1, 2 * p)
    val = truncate(Np, p)
    digits = [int(c) for c in str(val) if c.isdigit()]
    avg = Fraction(sum(digits), p)
    avg_disp = truncate(avg, p)
    ok = (val == avg_disp)
    count += int(ok)
    print(f"p={p:3d} N_p={val} sumd={sum(digits):3d} match={ok}")
print(f"Bollier numbers produced so far: {count}")

The script prints "match=True" for p=7,11,13,17,19,23,29,47,59p = 7, 11, 13, 17, 19, 23, 29, 47, 59, the first nine primes in [7,60][7, 60] with even-length repetend of 1/p1/p. Each row is a freshly minted Bollier number. The same recipe applied to larger such primes produces arbitrarily many more, so the count is unbounded.