Problem

Source: Israel National Olympiad 2017 Q2

Tags: number theory, Product, Digits, maximize



Denote by $P(n)$ the product of the digits of a positive integer $n$. For example, $P(1948)=1\cdot9\cdot4\cdot8=288$. Evaluate the sum $P(1)+P(2)+\dots+P(2017)$. Determine the maximum value of $\frac{P(n)}{n}$ where $2017\leq n\leq5777$.