getting wrong answer for cutting recipe What’s the error in my code?

It need not always be the smallest number of array you need to divide with, to get the cut down recipes.
Take this example

3 4 6 8

Answer should be 2 3 4. But your code outputs 4 6 8. I hope you get what you missed out.