[TL/DR Answer is 11]
Considering the optimum cost:
- For, the base case, a set of magnitude $1$ then the cost is $C_1 =2$
- For a set $X$ (of size $x$) then this can be split into sub-sets $Y$ (of size $y$) and $X\backslash Y$ then
- $X\backslash Y$ has size $z=x-y$;
- The probability $P_{y}$ of the answer being in $Y$ is $\frac{y}{x}$;
- The probability $P_{z}$ of the answer being in $X\backslash Y$ is $\frac{x-y}{x}$;
- The cost $C_{(x,y)}$ for this combination of set and sub-set sizes is given by: $\begin{split} C_{(x,y)} & = \begin{cases} P_{y} \cdot 2 + P_{z} \cdot (1+C_{z}) & \text{if } y=1\\ P_{y} \cdot (2+C_{y}) + P_{z} \cdot (1+C_{z}) & \text{if } y>1\end{cases} \\ &= \begin{cases} \frac{2 + (x-1) \cdot (1+C_{z})}{x} & \text{if } y=1\\ \frac{y \cdot (2+C_{y}) + (x-y) \cdot (1+C_{z})}{x} & \text{if } y>1\end{cases} \end{split}$
- The optimum cost $C_x = \text{min} \left( \forall_{y=1 \ldots \lfloor \frac{x}{2} \rfloor } C_{(x,y)} \right)$
This can then be used iteratively to generate costs for successively increasing sized sets.
The following Java code does this:
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
public class Coins {
static final int SIZE = 200;
static final BigDecimal TWO = new BigDecimal( "2" );
public static void main(String[] args) {
final ArrayList<BigDecimal> costs = new ArrayList<BigDecimal>( SIZE + 1 );
final ArrayList<Integer> values = new ArrayList<Integer>();
costs.add( BigDecimal.ZERO );
costs.add( TWO );
for ( int size = 2; size <= SIZE; ++size )
{
costs.add( new BigDecimal( SIZE ) );
values.clear();
BigDecimal setSize = new BigDecimal( size );
for ( int firstSubSetSize = 1; firstSubSetSize <= size / 2; ++firstSubSetSize )
{
int secondSubSetSize = size - firstSubSetSize;
BigDecimal setSize1 = new BigDecimal( firstSubSetSize );
BigDecimal setSize2 = new BigDecimal( secondSubSetSize );
BigDecimal cost1 = firstSubSetSize == 1 ? TWO : TWO.add( costs.get( firstSubSetSize ) );
BigDecimal cost2 = BigDecimal.ONE.add( costs.get( secondSubSetSize ) );
BigDecimal cost = cost1.multiply( setSize1 ).add( cost2.multiply( setSize2 ) ).setScale( 50, RoundingMode.HALF_UP ).divide( setSize, RoundingMode.HALF_UP );
if ( costs.get( size ) == null )
{
costs.set( size, cost );
values.add( firstSubSetSize );
}
else
{
switch( cost.compareTo( costs.get( size ) ) )
{
case -1: values.clear();
case 0: values.add( firstSubSetSize );
costs.set( size, cost );
break;
default: break;
}
}
}
System.out.println( size + " : " + costs.get( size ).toPlainString() + " : " + values.toString() );
}
}
}
And gives the output (first column is the starting set size, second column is the optimum cost and third column is the list of sub-set sizes which Bob can pick that will give that optimum cost):
2 : 2.50000000000000000000000000000000000000000000000000 : [1]
3 : 3.00000000000000000000000000000000000000000000000000 : [1]
4 : 3.50000000000000000000000000000000000000000000000000 : [1]
5 : 4.00000000000000000000000000000000000000000000000000 : [1]
6 : 4.50000000000000000000000000000000000000000000000000 : [1, 2, 3]
7 : 4.71428571428571428571428571428571428571428571428571 : [3]
8 : 5.00000000000000000000000000000000000000000000000000 : [3, 4]
9 : 5.22222222222222222222222222222222222222222222222222 : [4]
10 : 5.50000000000000000000000000000000000000000000000000 : [3, 4, 5]
11 : 5.63636363636363636363636363636363636363636363636363 : [4]
12 : 5.83333333333333333333333333333333333333333333333333 : [4, 5]
13 : 6.00000000000000000000000000000000000000000000000000 : [4, 5]
14 : 6.14285714285714285714285714285714285714285714285714 : [5]
15 : 6.33333333333333333333333333333333333333333333333333 : [4, 5, 6, 7]
16 : 6.43750000000000000000000000000000000000000000000000 : [5, 7]
17 : 6.58823529411764705882352941176470588235294117647058 : [6]
18 : 6.66666666666666666666666666666666666666666666666666 : [7]
19 : 6.78947368421052631578947368421052631578947368421052 : [7, 8]
20 : 6.90000000000000000000000000000000000000000000000000 : [7, 8, 9]
21 : 7.00000000000000000000000000000000000000000000000000 : [7, 8, 9]
22 : 7.09090909090909090909090909090909090909090909090909 : [8, 9]
23 : 7.17391304347826086956521739130434782608695652173913 : [9]
24 : 7.29166666666666666666666666666666666666666666666666 : [9, 11]
25 : 7.36000000000000000000000000000000000000000000000000 : [9, 11]
26 : 7.46153846153846153846153846153846153846153846153846 : [8, 9, 10, 11, 12]
27 : 7.51851851851851851851851851851851851851851851851851 : [9]
28 : 7.60714285714285714285714285714285714285714285714285 : [9, 10, 11]
29 : 7.65517241379310344827586206896551724137931034482758 : [11]
30 : 7.73333333333333333333333333333333333333333333333333 : [11, 12]
31 : 7.80645161290322580645161290322580645161290322580645 : [11, 12, 13]
32 : 7.87500000000000000000000000000000000000000000000000 : [11, 12, 13, 14]
33 : 7.93939393939393939393939393939393939393939393939393 : [14]
34 : 8.00000000000000000000000000000000000000000000000000 : [11, 12, 13, 14]
35 : 8.05714285714285714285714285714285714285714285714286 : [12, 13, 14]
36 : 8.11111111111111111111111111111111111111111111111111 : [13, 14]
37 : 8.16216216216216216216216216216216216216216216216216 : [14]
38 : 8.23684210526315789473684210526315789473684210526315 : [14]
39 : 8.28205128205128205128205128205128205128205128205128 : [14, 16]
40 : 8.34999999999999999999999999999999999999999999999999 : [13]
41 : 8.39024390243902439024390243902439024390243902439024 : [14, 16, 18]
42 : 8.45238095238095238095238095238095238095238095238095 : [13, 14, 15, 16, 17, 18, 19]
43 : 8.48837209302325581395348837209302325581395348837209 : [14, 16, 18]
44 : 8.54545454545454545454545454545454545454545454545454 : [14, 15, 16, 17, 18, 19]
45 : 8.57777777777777777777777777777777777777777777777777 : [16, 18]
46 : 8.63043478260869565217391304347826086956521739130434 : [17, 18, 19]
47 : 8.65957446808510638297872340425531914893617021276595 : [18]
48 : 8.70833333333333333333333333333333333333333333333333 : [18, 19]
49 : 8.75510204081632653061224489795918367346938775510204 : [18, 19, 20]
50 : 8.80000000000000000000000000000000000000000000000000 : [18, 19, 20, 21]
51 : 8.84313725490196078431372549019607843137254901960783 : [18]
52 : 8.88461538461538461538461538461538461538461538461538 : [18, 19, 20, 21, 22, 23]
53 : 8.92452830188679245283018867924528301886792452830188 : [19, 20, 23]
54 : 8.96296296296296296296296296296296296296296296296296 : [18, 19, 20, 21, 22, 23]
55 : 8.99999999999999999999999999999999999999999999999999 : [22]
56 : 9.03571428571428571428571428571428571428571428571428 : [19, 23]
57 : 9.07017543859649122807017543859649122807017543859649 : [20, 21, 22, 23]
58 : 9.10344827586206896551724137931034482758620689655172 : [21, 22]
59 : 9.13559322033898305084745762711864406779661016949152 : [22, 23]
60 : 9.16666666666666666666666666666666666666666666666667 : [23]
61 : 9.21311475409836065573770491803278688524590163934426 : [22, 23, 24, 25]
62 : 9.24193548387096774193548387096774193548387096774193 : [23, 25]
63 : 9.28571428571428571428571428571428571428571428571428 : [22, 23, 24, 25, 26, 27]
64 : 9.31250000000000000000000000000000000000000000000000 : [23, 25, 27]
65 : 9.35384615384615384615384615384615384615384615384615 : [22, 23, 24, 25, 26, 27, 28, 29]
66 : 9.37878787878787878787878787878787878787878787878787 : [27, 29]
67 : 9.41791044776119402985074626865671641791044776119402 : [22, 27, 29]
68 : 9.44117647058823529411764705882352941176470588235294 : [23, 25, 27, 29]
69 : 9.47826086956521739130434782608695652173913043478260 : [22, 23, 24, 27, 28, 29]
70 : 9.49999999999999999999999999999999999999999999999999 : [23, 27]
71 : 9.53521126760563380281690140845070422535211267605633 : [24, 25, 26, 27, 28, 29, 30]
72 : 9.55555555555555555555555555555555555555555555555555 : [25, 27, 29]
73 : 9.58904109589041095890410958904109589041095890410958 : [26, 27, 28, 29]
74 : 9.60810810810810810810810810810810810810810810810810 : [27, 29]
75 : 9.63999999999999999999999999999999999999999999999999 : [27, 28, 29, 30]
76 : 9.65789473684210526315789473684210526315789473684210 : [29]
77 : 9.68831168831168831168831168831168831168831168831168 : [29, 30]
78 : 9.71794871794871794871794871794871794871794871794871 : [30, 31]
79 : 9.74683544303797468354430379746835443037974683544303 : [32]
80 : 9.77499999999999999999999999999999999999999999999999 : [29, 33]
81 : 9.80246913580246913580246913580246913580246913580246 : [29, 30, 33, 34]
82 : 9.82926829268292682926829268292682926829268292682926 : [29, 30, 31, 33]
83 : 9.85542168674698795180722891566265060240963855421686 : [29, 30, 31, 32, 33, 36]
84 : 9.88095238095238095238095238095238095238095238095237 : [29, 33]
85 : 9.90588235294117647058823529411764705882352941176470 : [29, 30, 31, 32, 33, 34, 36, 37]
86 : 9.93023255813953488372093023255813953488372093023255 : [30, 31, 33, 35]
87 : 9.95402298850574712643678160919540229885057471264367 : [29, 31, 32, 33, 34, 36]
88 : 9.97727272727272727272727272727272727272727272727272 : [29, 30, 32, 33, 35, 36, 37]
89 : 9.99999999999999999999999999999999999999999999999999 : [33, 34]
90 : 10.02222222222222222222222222222222222222222222222222 : [30, 31, 32, 33, 34, 35, 36, 37]
91 : 10.04395604395604395604395604395604395604395604395604 : [32, 33, 34, 35, 36, 37]
92 : 10.06521739130434782608695652173913043478260869565217 : [33, 34, 35, 36, 37]
93 : 10.08602150537634408602150537634408602150537634408602 : [33, 34, 35, 36, 37]
94 : 10.10638297872340425531914893617021276595744680851064 : [34, 35, 36, 37]
95 : 10.12631578947368421052631578947368421052631578947368 : [36, 37]
96 : 10.14583333333333333333333333333333333333333333333333 : [37]
97 : 10.16494845360824742268041237113402061855670103092784 : [37]
98 : 10.19387755102040816326530612244897959183673469387755 : [36, 37, 38, 39]
99 : 10.21212121212121212121212121212121212121212121212121 : [37, 39]
100 : 10.23999999999999999999999999999999999999999999999999 : [38]
101 : 10.25742574257425742574257425742574257425742574257425 : [39]
102 : 10.28431372549019607843137254901960784313725490196078 : [36, 37, 38, 39, 40, 41, 43]
103 : 10.30097087378640776699029126213592233009708737864077 : [37, 41]
104 : 10.32692307692307692307692307692307692307692307692307 : [37, 38, 39, 40, 41, 42, 43, 45]
105 : 10.34285714285714285714285714285714285714285714285714 : [37, 39, 41, 43, 45]
106 : 10.36792452830188679245283018867924528301886792452829 : [36, 39, 40]
107 : 10.38317757009345794392523364485981308411214953271027 : [37, 41, 45]
108 : 10.40740740740740740740740740740740740740740740740740 : [36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 47]
109 : 10.42201834862385321100917431192660550458715596330275 : [37, 39, 41, 43, 45, 47]
110 : 10.44545454545454545454545454545454545454545454545454 : [36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48]
111 : 10.45945945945945945945945945945945945945945945945945 : [37, 41, 45]
112 : 10.48214285714285714285714285714285714285714285714285 : [36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47]
113 : 10.49557522123893805309734513274336283185840707964601 : [37, 39, 41, 43, 45, 47]
114 : 10.51754385964912280701754385964912280701754385964911 : [40, 44, 45, 47]
115 : 10.53043478260869565217391304347826086956521739130434 : [39, 41, 43, 45, 47]
116 : 10.55172413793103448275862068965517241379310344827585 : [41, 45, 46, 47]
117 : 10.56410256410256410256410256410256410256410256410256 : [41, 43, 45, 47]
118 : 10.58474576271186440677966101694915254237288135593219 : [45]
119 : 10.59663865546218487394957983193277310924369747899159 : [43, 45, 47]
120 : 10.61666666666666666666666666666666666666666666666666 : [43, 44, 45, 46, 47, 48]
121 : 10.62809917355371900826446280991735537190082644628098 : [47]
122 : 10.64754098360655737704918032786885245901639344262294 : [45, 46, 47, 48]
123 : 10.65853658536585365853658536585365853658536585365853 : [47]
124 : 10.67741935483870967741935483870967741935483870967741 : [47, 48]
125 : 10.69599999999999999999999999999999999999999999999999 : [47, 48]
126 : 10.71428571428571428571428571428571428571428571428571 : [47, 48, 49, 50]
127 : 10.73228346456692913385826771653543307086614173228346 : [47, 48, 49, 50, 51]
128 : 10.74999999999999999999999999999999999999999999999999 : [47, 48, 49, 51]
129 : 10.76744186046511627906976744186046511627906976744185 : [47, 48, 49, 51, 52, 53]
130 : 10.78461538461538461538461538461538461538461538461537 : [51]
131 : 10.80152671755725190839694656488549618320610687022900 : [47, 48, 49, 50, 51, 52, 53, 54, 55]
132 : 10.81818181818181818181818181818181818181818181818181 : [47, 48, 49, 50, 51, 52, 53, 54, 55, 56]
133 : 10.83458646616541353383458646616541353383458646616540 : [51, 53, 55]
134 : 10.85074626865671641791044776119402985074626865671641 : [47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58]
135 : 10.86666666666666666666666666666666666666666666666665 : [51]
136 : 10.88235294117647058823529411764705882352941176470587 : [47, 51, 52, 55, 56]
137 : 10.89781021897810218978102189781021897810218978102189 : [47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]
138 : 10.91304347826086956521739130434782608695652173913042 : [51]
139 : 10.92805755395683453237410071942446043165467625899280 : [47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]
140 : 10.94285714285714285714285714285714285714285714285713 : [51, 56]
141 : 10.95744680851063829787234042553191489361702127659574 : [47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]
142 : 10.97183098591549295774647887323943661971830985915492 : [47, 51, 53, 54, 55, 56, 58, 59]
143 : 10.98601398601398601398601398601398601398601398601398 : [47, 48, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]
144 : 10.99999999999999999999999999999999999999999999999999 : [51, 55, 56, 57, 58, 59]
145 : 11.01379310344827586206896551724137931034482758620689 : [49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]
146 : 11.02739726027397260273972602739726027397260273972602 : [51, 53, 54, 55, 56, 57, 58, 59, 60]
147 : 11.04081632653061224489795918367346938775510204081632 : [51, 52, 54, 55, 56, 57, 58, 59, 60]
148 : 11.05405405405405405405405405405405405405405405405405 : [51, 52, 53, 54, 55, 56, 57, 58, 59, 60]
149 : 11.06711409395973154362416107382550335570469798657718 : [52, 53, 54, 55, 56, 57, 58, 59, 60]
150 : 11.07999999999999999999999999999999999999999999999999 : [55]
151 : 11.09271523178807947019867549668874172185430463576158 : [55, 56, 59]
152 : 11.10526315789473684210526315789473684210526315789473 : [56, 57, 59]
153 : 11.11764705882352941176470588235294117647058823529411 : [58]
154 : 11.12987012987012987012987012987012987012987012987013 : [57, 58, 59, 60]
155 : 11.14193548387096774193548387096774193548387096774193 : [59, 60]
156 : 11.15384615384615384615384615384615384615384615384615 : [59, 60]
157 : 11.16560509554140127388535031847133757961783439490446 : [60]
158 : 11.18354430379746835443037974683544303797468354430379 : [59, 62]
159 : 11.19496855345911949685534591194968553459119496855346 : [60, 62]
160 : 11.21249999999999999999999999999999999999999999999999 : [59]
161 : 11.22360248447204968944099378881987577639751552795031 : [60, 62, 64]
162 : 11.24074074074074074074074074074074074074074074074073 : [59, 62]
163 : 11.25153374233128834355828220858895705521472392638036 : [62]
164 : 11.26829268292682926829268292682926829268292682926829 : [59, 60, 61, 62, 63, 64, 65, 66, 67, 68]
165 : 11.27878787878787878787878787878787878787878787878787 : [62, 64, 66]
166 : 11.29518072289156626506024096385542168674698795180722 : [59, 60, 62, 63, 65, 66, 67, 70]
167 : 11.30538922155688622754491017964071856287425149700598 : [60, 62, 64, 66]
168 : 11.32142857142857142857142857142857142857142857142856 : [61, 62, 67]
169 : 11.33136094674556213017751479289940828402366863905325 : [60, 62, 64, 66, 68, 70, 72]
170 : 11.34705882352941176470588235294117647058823529411764 : [59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74]
171 : 11.35672514619883040935672514619883040935672514619882 : [64, 70]
172 : 11.37209302325581395348837209302325581395348837209301 : [66]
173 : 11.38150289017341040462427745664739884393063583815028 : [62, 66, 70, 72, 74]
174 : 11.39655172413793103448275862068965517241379310344827 : [59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77]
175 : 11.40571428571428571428571428571428571428571428571428 : [60, 62, 64, 66, 68, 70, 72, 74, 76]
176 : 11.42045454545454545454545454545454545454545454545453 : [70]
177 : 11.42937853107344632768361581920903954802259887005649 : [62, 64, 66, 70, 72, 74, 76]
178 : 11.44382022471910112359550561797752808988764044943819 : [60, 62, 64, 66, 67, 70, 71, 72, 74, 75, 77]
179 : 11.45251396648044692737430167597765363128491620111731 : [62, 64, 66, 68, 70, 72, 74, 76]
180 : 11.46666666666666666666666666666666666666666666666666 : [59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77]
181 : 11.47513812154696132596685082872928176795580110497237 : [60, 62, 64, 66, 68, 70, 72, 74, 76]
182 : 11.48901098901098901098901098901098901098901098901098 : [59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77]
183 : 11.49726775956284153005464480874316939890710382513660 : [62, 70, 72, 76]
184 : 11.51086956521739130434782608695652173913043478260868 : [66, 70]
185 : 11.51891891891891891891891891891891891891891891891891 : [62, 64, 66, 70, 72, 74]
186 : 11.53225806451612903225806451612903225806451612903225 : [62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77]
187 : 11.54010695187165775401069518716577540106951871657753 : [66, 70, 72, 74, 76]
188 : 11.55319148936170212765957446808510638297872340425531 : [64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77]
189 : 11.56084656084656084656084656084656084656084656084655 : [66, 68, 70, 74, 76]
190 : 11.57368421052631578947368421052631578947368421052631 : [66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77]
191 : 11.58115183246073298429319371727748691099476439790575 : [68, 70, 72, 74, 76]
192 : 11.59374999999999999999999999999999999999999999999999 : [68, 69, 70, 71, 72, 73, 74, 75, 76, 77]
193 : 11.60103626943005181347150259067357512953367875647667 : [72]
194 : 11.61340206185567010309278350515463917525773195876288 : [70, 71, 72, 73, 74, 75, 76, 77]
195 : 11.62051282051282051282051282051282051282051282051281 : [72, 74, 76]
196 : 11.63265306122448979591836734693877551020408163265305 : [72, 73, 74, 75, 77]
197 : 11.63959390862944162436548223350253807106598984771573 : [74, 76]
198 : 11.65151515151515151515151515151515151515151515151514 : [74, 75, 76, 77]
199 : 11.65829145728643216080402010050251256281407035175879 : [76]
200 : 11.66999999999999999999999999999999999999999999999999 : [76, 77]
As a side note: If you plot the set size against the (multiple) optimal sub-set sizes then you get an interesting pattern.
x
. $\endgroup$