4
$\begingroup$

Is it possible to modify an answer so that all numbers have the same denominator? E.g.

Table[(27 - k)/15, {k, 0, 29}]

returns

{9/5, 26/15, 5/3, 8/5, 23/15, 22/15, 7/5, 4/3, 19/15, ...

Would it be possible to get

{27/15, 26/15, 25/15, 24/15, 23/15, 22/15, 21/15, 20/15, 19/15, ...

The example above is trivial, but assuming an output of

{2/3, 3/11, 5/17}

one would transform it into

{374/561, 153/561, 165/561}

TIA.

$\endgroup$
0
7
$\begingroup$
With[{x = LCM @@ Denominator @ #}, # x / Defer[x]] & @ {2/3, 3/11, 5/17}
{374/561, 153/561, 165/561}
Table[(27 - k)/15, {k, 0, 29}]

enter image description here

With[{x = LCM @@ Denominator@#}, # x / Defer[x]] & @ %

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks. Is there some method for a general "answer", like "{2/3, 3/11, 5/17}" above? $\endgroup$
    – mf67
    Oct 23 '20 at 17:50
  • $\begingroup$ @mf67, please see the updated version. $\endgroup$
    – kglr
    Oct 23 '20 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.