Brute force is impossible because the numbers can have up to 10,000 digits. Instead, you want to construct the number in the interval [min,max][min,max][min,max] whose product of digits is maximal whose product of digits is maximal.