"Fouriest" Transform of An Integer
Haskell, 82 bytes
The function 'f' gives the final result:
_#0=0
b#x=sum[1|4==mod x b]+b#div x b
f x=[b|b&lt;-[5..x],and[b#x&gt;=c#x|c&lt;-[b..x]]]!!0

Less golfed:
countFours 0    _ = 0
countFours base x | x == 0          = 0
                  | mod x base == 4 = 1 + countFours (div x base) base

f x = head [base | base &lt;- [5..x], and smallerBasesNotFouriest]
  where
    smallerBasesNotFouriest = [(countFours base x) &gt;= (countFours base' x) | base' &lt;- [5..base]]