There are two urns, each with some numbered cards inside.
In urn A there are cards representing all 3digit numbers (from 109 to 910 inclusively), having 10 as their sum of digits.
In urn B  all 3digit numbers (from 119 to 920 inclusively), with 11 as their s.o.d.
Assuming you aim to randomly draw a prime number,
which urn would you choose?
What if there was a 3rd urn with s.o.d=15, would you consider it as a good choice?
5 Digsum=10
10 for N=100 to 999
20 S=fnSod(N)
30 if S=Digsum and prmdiv(N)=N then print N;:inc Ct:next
35 if S=Digsum then inc Ct2:next
40 next
50 print:print Ct,Ct2,Ct/Ct2
60 end
1070 fnSOD(X)
1080 Sod=0
1090 S=cutspc(str(X))
1100 for I=1 to len(S)
1110 Sod=Sod+val(mid(S,I,1))
1120 next
1130 return(Sod)
finds the primes
109 127 163 181 271 307 433 523 541 613 631 811
which are 12 out of the 42 cards for prob = 0.2857142857142857142
Changing the digital sum to 11 gives
137 173 191 227 263 281 317 353 443 461 641 821 911
or 13 out of 48, with prob = 0.2708333333333333333
so the former urn is better.
When the s.o.d. is 15 all numbers are multiples of three and therefore have no primes. That urn would not be a good choice.

Posted by Charlie
on 20130110 18:36:33 