Given a Percentage, Find the Smallest Integer Dividend for an Unknown Number of Integer Tests

1.3k Views Asked by At

In a classroom exam where each question is worth 1 point and the number of exam questions are unknown. If the student receives results of a test in a percentage with decimals, let's say 78.5%, what is the formula to determine the smallest integer dividend that is the number of questions on the test?

For example:

  • 78.5% = 785/1000
  • 78.5% = 471/600
  • 78.5% = 157/200

Through successive approximation, 200 appears to be the number of questions on the test, because 157 out of 200 yields the given percentage.

1

There are 1 best solutions below

2
On BEST ANSWER

Given an input of $x$ percentage, where $x$ can be represented on base $10$ as $m$ digits before the decimal point and $n$ digits after the decimal point, the minimum number of questions is:

$$\frac{10^{m+n}}{\gcd(10^{m+n},10^nx)}$$