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
re: solution by Charlie)
another way of showing this:
The new percents introduced at the b's under 20:
new unrounded
b % a b value
1
---> 0 0/1 0.000000000 *
2
---> 50 1/2 0.500000000 *
3
---> 33 1/3 0.333333333
4
---> 25 1/4 0.250000000 *
5
---> 20 1/5 0.200000000 *
---> 40 2/5 0.400000000 *
6
---> 17 1/6 0.166666667
7
---> 14 1/7 0.142857143
---> 29 2/7 0.285714286
---> 43 3/7 0.428571429
8
---> 13 1/8 0.125000000
---> 38 3/8 0.375000000
9
---> 11 1/9 0.111111111
---> 22 2/9 0.222222222
---> 44 4/9 0.444444444
10
---> 10 1/10 0.100000000 *
---> 30 3/10 0.300000000 *
11
---> 9 1/11 0.090909091
---> 18 2/11 0.181818182
---> 27 3/11 0.272727273
---> 36 4/11 0.363636364
---> 45 5/11 0.454545455 *
12
---> 8 1/12 0.083333333
---> 42 5/12 0.416666667
13
---> 15 2/13 0.153846154 *
---> 23 3/13 0.230769231
---> 31 4/13 0.307692308
---> 46 6/13 0.461538462
14
---> 7 1/14 0.071428571
---> 21 3/14 0.214285714
15
---> 47 7/15 0.466666667
16
---> 6 1/16 0.062500000
---> 19 3/16 0.187500000
17
---> 12 2/17 0.117647059
---> 24 4/17 0.235294118
---> 35 6/17 0.352941176 *
---> 41 7/17 0.411764706
18
---> 28 5/18 0.277777778
---> 39 7/18 0.388888889
19
---> 5 1/19 0.052631579 *
---> 16 3/19 0.157894737
---> 26 5/19 0.263157895
---> 32 6/19 0.315789474
---> 37 7/19 0.368421053
All 11 of the percents achievable with b=20 (marked with an *) are present in the above, and each b above has added at least one new percent not present above it.
DEFDBL A-Z
DIM did(50)
FOR b = 1 TO 20
PRINT b
good = 1
FOR a = 0 TO b / 2
pct = INT(100 * a / b + .5)
IF did(pct) = 0 THEN
good = 0
PRINT USING "& ## ##"; "--->"; pct; a;
PRINT "/"; LTRIM$(STR$(b)); TAB(20);
PRINT USING "##.#########"; a / b
END IF
did(pct) = 1
NEXT a
NEXT b
PRINT
b = 20
FOR a = 0 TO 10
PRINT a, INT(100 * a / b + .5)
NEXT
|
Posted by Charlie
on 2010-01-11 15:01:46 |