a/b = b% when rounded to the nearest percent.
[1] What are the smallest 5 possible values of b?
[2] What is the largest value b cannot assume?
Now let us generalize the second part.
[3] Find the largest value of b where a/b cannot equal b when it is multiplied by 10^n and rounded to the nearest whole number. (Part [2] is n=2)
Solve for n = 1, 2, 3, 4, ...
Part 1:
The five smallest possible values of b are 10, 14, 20, 30 and 33, as shown in the table below for the 47 smallest possible values of b.
DEFDBL A-Z
FOR b = 1 TO 10000
a0 = b * b / 100
a1 = INT(a0) ' int is floor function
a2 = -INT(-a0) ' this results in ceiling
p1 = INT(100 * a1 / b + .5)
p2 = INT(100 * a2 / b + .5)
IF p1 = b THEN a = a1: ELSE IF p2 = b THEN a = a2: ELSE a = -1
IF a > 0 THEN
IF ct < 47 THEN PRINT a; b, 100 * a / b
ct = ct + 1
ELSE
badB = b
END IF
NEXT b
PRINT badB
a b %
1 10 10
2 14 14.28571428571429
4 20 20
9 30 30
11 33 33.33333333333334
13 36 36.11111111111111
16 40 40
17 41 41.46341463414634
21 46 45.65217391304348
22 47 46.80851063829788
23 48 47.91666666666666
24 49 48.97959183673469
25 50 50
26 51 50.98039215686274
27 52 51.92307692307692
28 53 52.83018867924528
29 54 53.7037037037037
30 55 54.54545454545455
35 59 59.32203389830509
36 60 60
37 61 60.65573770491803
40 63 63.49206349206349
41 64 64.0625
42 65 64.61538461538461
45 67 67.16417910447761
46 68 67.64705882352941
49 70 70
52 72 72.22222222222223
53 73 72.60273972602739
55 74 74.32432432432432
56 75 74.66666666666667
58 76 76.31578947368421
59 77 76.62337662337663
61 78 78.2051282051282
64 80 80
66 81 81.48148148148148
67 82 81.70731707317073
69 83 83.13253012048193
72 85 84.70588235294117
74 86 86.04651162790698
76 87 87.35632183908046
77 88 87.5
79 89 88.76404494382022
81 90 90
83 91 91.20879120879121
85 92 92.39130434782609
88 94 93.61702127659575
Part 2:
The above program also produces the answer to part 2:
93
Beginnings of part 3:
b
1 6
2 93
3 950
4 9842
5 99500
6 999293
7 9997764
8 9999999
The below program was stopped at this point as the answers had become meaningless as they had become limited by the internal limitations of the program, instituted for time purposes.
DEFDBL A-Z
CLS
mult = 10
FOR pwr = 1 TO 20
FOR b = 1 TO 10000000
a0 = b * b / mult
a1 = INT(a0) ' int is floor function
a2 = -INT(-a0) ' this results in ceiling
p1 = INT(mult * a1 / b + .5)
p2 = INT(mult * a2 / b + .5)
IF p1 = b THEN a = a1: ELSE IF p2 = b THEN a = a2: ELSE a = -1
IF a > 0 THEN
REM nothing here
ELSE
badB = b
END IF
NEXT b
PRINT pwr, badB
mult = mult * 10
NEXT pwr
|
Posted by Charlie
on 2010-01-20 14:24:38 |