$F_4(X)$ be the number of digits 4 in the decimal representation of $X$, and $F_7(X)$ be the number of digits 7 in the decimal representation of $X$. We have to find largest product $F_4(X)\cdot F_7(X)$, where $L \leq X \leq R$.
$$\max\{F_4(X)\cdot F_7(X) : L ≤ X ≤ R\}$$
can a general solution be acheived?
eg:
$L=47$ AND $R=74$
$$\max\{F_4(X)\cdot F_7(X)\}=1$$