Sure, but it gets them all. If you want it to generate only unique ones, then generalize from binary to a variable base, where the base in a given position is the exponent on the corresponding prime. On 7/19/07, Mike Speciner <speciner@ll.mit.edu> wrote:
Only if the number is square free. Else it generates the same factor multiple times.
--ms
Mike Stay wrote:
Well, here's a program that will generate them for you given the prime factors. Given n factors, for i=0 to 2^n - 1 d = 1 for j=0 to n-1 if bit j of i is set (*) d = d * jth factor end print d end
(*) in C, this is if (i & (1<<j))
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com http://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
-- Mike Stay metaweta@gmail.com http://math.ucr.edu/~mike