Sorry if this isn't really the correct place for this, but I tried looking online for a solution, and can't find it anywhere, and the things I've seen people pull of with numbers on this forum are incredible.

I'm trying to set up a system that will work out the division of a number, and so I have Var1/Var2=Var3, but I only want to use numbers that will divide into whole numbers. I have therefore set it up so that it will only show me even numbers, and to do this, I used the expression choose(2,4,6,8...) as the first variable, and then 2 as the second, as that is the only way I can guarantee a whole number.

I thought about having a system that would divide the first variable by 2, and then generate randomly from 0 to that figure, but I knew I'd end up getting decimals (10/4=2.5).

Is there an equation that would choose numbers that would generate a whole number as a result?

What exactly is your ultimate goal? Is it really just to divide 2 numbers resulting in a whole number. If it is, you've already done that. However, I'm guessing your ultimate goal is something a bit more complex. Could you elaborate a bit?

When trying to convert numbers with decimals into integers, the following expressions are useful:

round(x): Round x to the nearest whole number e.g. round(5.6) = 6

Ah, I misinterpreted you original post. You're looking to determine all factors for a number. Well I'm sure there is a more elegant way to do it, but here's one method:

I use a method called trial factoring. Basically, you take the starting number, take its square route and round it up to the nearest integer(i.e. whole number). Let's call that number "i". Now, try dividing the original number by every integer between 0 and i. For every division resulting in an integer, both "i" and the result are factors. Here's an example:

Starting number = 22

The square route of 22 rounded up = 5

22/1 = 22, so 1 and 22 are factors

22/2 = 11, so 2 and 11 are factors

22/3 = not an integer, so no factors

22/4 = not an integer, so no factors

22/5 = not an integer, so no factors

I hope this helps.

EDIT - Updated capx to use a much less convoluted method for testing for integers, incorporated an array to make sorting easier, and annotated everything. AnD4D