← Back to challenges

Amount of Unique Fractions

PythonHardalgorithmsmathloops

Instructions

Create a function double unique_fract(), which should sum all irreducible regular fractions between 0 and 1, in the numerator and denominator of which there are only single-digit numbers: 1/2, 1/3, 1/4, ... 2/3, 2/4, ... 8/9.

Examples

unique_fract() ➞ sum

Notes

  • Of the fractions 1/2 2/4 3/6 4/8, only 1/2 is included in the sum.
  • Don't include any values >= 1.
  • Both the numerator and denominator are single digit.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.