IBM Research

PUZZLE   IBM-320

Counting numbers with specific digits

IBM Research · Ponder This · 2024-12

IBM Ponder This #320 · December 2024

Denote by ωd(n) the size of the set of all natural numbers between 1 and n that have the digit d in their usual decimal representation. For example, ω1(1456)=728 and ω7(1456)=352.

We see that for n=1456, we have ω1(n)n=12, i.e., exactly 50% of the numbers up to 1456 contain the digit 1. For d=7, we have ω7(n)n=2291.

Your goal: For each d between 1 and 9, find the maximum value of n for which ωd(n)n=12.

An optional goal: Find a simple formula f(d) giving those maximum values for as many values of d as possible.

A bonus "*" will be given for finding the maximum value of n for which ω1(n)n=34 (i.e., only solve the case d=1. but for 34 this time).

Solution

Best opened after a real attempt

To be added.