Minimize Array Sum Using Divisible Replacements
Each value can drop to the smallest present value that divides it. Those targets always stay available, so the scan picks them directly.
Each value can drop to the smallest present value that divides it. Those targets always stay available, so the scan picks them directly.