Given whole numbers a and b we can find the ratio a/b and round it to the nearest whole percent.
A value of b is said to generate any percentage that is a possible value of a/b.
For example b=15 generates seven percentages between 0 and 50 including 27% = 4/15 and 47% = 7/15.
There is no smaller b that generates 47% but there is a smaller b (11) that generates 27% (3/11)
What is the smallest value of b such that for every percentage between 0 and 50 that it generates there is a smaller b that also generates it?
(In reply to
solution by Dej Mar)
Verified that 20 is the smallest:
The complete list of b's that satisfy the criterion:
20 22 24 25 26 27 28 30 31 32 33 34 36 37 38 39 40 42 43 44
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
65 66 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
DEFDBL A-Z
DIM did(50)
FOR b = 1 TO 100
good = 1
FOR a = 0 TO b / 2
pct = INT(100 * a / b + .5)
IF did(pct) = 0 THEN good = 0
did(pct) = 1
NEXT a
IF good THEN PRINT b;
NEXT b
PRINT
|
Posted by Charlie
on 2010-01-11 14:34:53 |