← ALL NOTES
Math

3348. Smallest Divisible Digit Product II

The digit product of any number only ever carries the primes 2, 3, 5, and 7, so before touching num I factor t into 2^a * 3^b * 5^c * 7^d. If anything is left over — a stray 11 or 13 — no product of digits 1-9 can supply it, and the answer is -1 outright.

Loading…