Note: as this question has been marked as a duplicate, I have accepted an answer. However, I will still check this question if users can find a shorter way of doing it, and accept that answer.
Given two numbers (which are multiples of
tails-percentage from a series of coin-flipping, output the minimum amounts of heads and tails to produce percentages such as those. Input and output can be in any form. However, output must be in a readable format (Good examples are
[x y], etc).
25 75(25% heads, 75% tails) Output:
1 3(an output of
25 75is invalid since that is not the minimum amounts of heads and tails to produce those percentages)
30 70(30% heads, 70% tails) Output:
99.5 0.5(99.5% heads, 0.5% tails) Output:
You may assume that there will always be a digit before and after a decimal point in an input (no
15.s). You may also assume the input adds up to 100%. This is code-golf, shortest code in bytes wins!