# The Fast And The Fouriest

Define the Fouriest Transform of a number $n$ to be the base-$b$ representation of $n$ whose digits contain the most $4$'s of all representations such that $b$ is minimized. If you wrote out the Fouriest Transform of all positive integers up to and including $9952$, let $N$ be the total number of $4$'s you would count in all of their digits. What are the last three digits of $N$?

Details and Assumptions

• As an explicit example, the Fouriest Transform of $224$ is $1344$ (base-$5$) which contains $2$ fours. Although its base-$7$ representation, $440$, also contains $2$ fours, $5$ is the smaller base.

• If there does not exists a base $b$ that $n$ can be represented in that has any fours, define the Fouriest Transform of that number $n$ to be its base-$10$ representation.

• This problem was inspired by the following Saturday Morning Breakfast Cereal Cartoon.

×