# Eliminating fractions in an array

I have an array in which every element is a fraction (some are real , some are a sum of real + complex part). I want to find the smallest common denominator in order to obtain a factor * array containing only integer numbers (real and complex).

Any ideas?

An example array:

A = {1/24 + 7i/32, 83/25, 4/78 + 9i/17...}


How about (with i changed to a proper imaginary unit: I)

A = {1/24 + 7 I/32, 83/25, 4/78 + 9 I/17};

den = Denominator[A]


{96, 25, 663}

lcm = LCM @@ den


530400

A*lcm // Expand


{22100 + 116025 I, 1760928, 27200 + 280800 I}

Indeed, lcm is smaller than Times @@ den == 1591200.

• Denominator[A] is enough with I instead of i.
– Kuba
Dec 5 '16 at 15:20
• Ha! That's what you get blindly assuming that the OP's input is correct ;) Dec 5 '16 at 15:25
• You could also use GCD @@ A Apr 25 '17 at 14:43

In:

A = {1/24 + 7 I/32, 83/25, 4/78 + 9 I/17};
Denominator[Plus @@ A] A


Out:

{22100 + 116025 I, 1760928, 27200 + 280800 I}

• Consider an array like {1/2,1/2} Apr 25 '17 at 6:57