A base ten positive integer is called a Matched Number if each of the respective sod’s in their duodecimal and hexadecimal representations is a prime number, where sod(x) represents the sum of the digits of x.
For example, 73 (base ten) is equal to 61 in the duodecimal system and, 49 in the hexadecimal system. Hence, 73 (base ten) is a Matched Number since each of the sods of 6112 and 4916 considered in their respective bases, is a prime number.
Determine the probability that X is a Matched Number, given that X is a positive integer drawn at random between 100 (base ten) and 9999 (base ten) inclusively.
(In reply to
computer solution by Charlie)
7954 4 7 2 10 1 15 1 2 23 19
7981 4 7 5 1 1 15 2 13 17 31
7994 4 7 6 2 1 15 3 10 19 29
8009 4 7 7 5 1 15 4 9 23 29
8026 4 7 8 10 1 15 5 10 29 31
8039 4 7 9 11 1 15 6 7 31 29
8048 4 7 10 8 1 15 7 0 29 23
8069 4 8 0 5 1 15 8 5 17 29
8071 4 8 0 7 1 15 8 7 19 31
8086 4 8 1 10 1 15 9 6 23 31
8126 4 8 5 2 1 15 11 14 19 41
8137 4 8 6 1 1 15 12 9 19 37
8141 4 8 6 5 1 15 12 13 23 41
8152 4 8 7 4 1 15 13 8 23 37
8158 4 8 7 10 1 15 13 14 29 43
8171 4 8 8 11 1 15 14 11 31 41
8182 4 8 9 10 1 15 15 6 31 37
8193 4 8 10 9 2 0 0 1 31 3
8208 4 9 0 0 2 0 1 0 13 3
8212 4 9 0 4 2 0 1 4 17 7
8218 4 9 0 10 2 0 1 10 23 13
8225 4 9 1 5 2 0 2 1 19 5
8240 4 9 2 8 2 0 3 0 23 5
8269 4 9 5 1 2 0 4 13 19 19
8284 4 9 6 4 2 0 5 12 23 19
8303 4 9 7 11 2 0 6 15 31 23
8306 4 9 8 2 2 0 7 2 23 11
8312 4 9 8 8 2 0 7 8 29 17
8314 4 9 8 10 2 0 7 10 31 19
8323 4 9 9 7 2 0 8 3 29 13
8336 4 9 10 8 2 0 9 0 31 11
8357 4 10 0 5 2 0 10 5 19 17
8368 4 10 1 4 2 0 11 0 19 13
8372 4 10 1 8 2 0 11 4 23 17
8438 4 10 7 2 2 0 15 6 23 23
8444 4 10 7 8 2 0 15 12 29 29
8446 4 10 7 10 2 0 15 14 31 31
8477 4 10 10 5 2 1 1 13 29 17
8479 4 10 10 7 2 1 1 15 31 19
8488 4 10 11 4 2 1 2 8 29 13
8509 4 11 1 1 2 1 3 13 17 19
8522 4 11 2 2 2 1 4 10 19 17
8533 4 11 3 1 2 1 5 5 19 13
8537 4 11 3 5 2 1 5 9 23 17
8543 4 11 3 11 2 1 5 15 29 23
8548 4 11 4 4 2 1 6 4 23 13
8554 4 11 4 10 2 1 6 10 29 19
8567 4 11 5 11 2 1 7 7 31 17
8576 4 11 6 8 2 1 8 0 29 11
8578 4 11 6 10 2 1 8 2 31 13
8633 4 11 11 5 2 1 11 9 31 23
8639 4 11 11 11 2 1 11 15 37 29
8642 5 0 0 2 2 1 12 2 7 17
8648 5 0 0 8 2 1 12 8 13 23
8657 5 0 1 5 2 1 13 1 11 17
8659 5 0 1 7 2 1 13 3 13 19
8663 5 0 1 11 2 1 13 7 17 23
8674 5 0 2 10 2 1 14 2 17 19
8701 5 0 5 1 2 1 15 13 11 31
8707 5 0 5 7 2 2 0 3 17 7
8720 5 0 6 8 2 2 1 0 19 5
8762 5 0 10 2 2 2 3 10 17 17
8764 5 0 10 4 2 2 3 12 19 19
8773 5 0 11 1 2 2 4 5 17 13
8779 5 0 11 7 2 2 4 11 23 19
8813 5 1 2 5 2 2 6 13 13 23
8822 5 1 3 2 2 2 7 6 11 17
8824 5 1 3 4 2 2 7 8 13 19
8828 5 1 3 8 2 2 7 12 17 23
8833 5 1 4 1 2 2 8 1 11 13
8839 5 1 4 7 2 2 8 7 17 19
8852 5 1 5 8 2 2 9 4 19 17
8867 5 1 6 11 2 2 10 3 23 17
8894 5 1 9 2 2 2 11 14 17 29
8911 5 1 10 7 2 2 12 15 23 31
8918 5 1 11 2 2 2 13 6 19 23
8954 5 2 2 2 2 2 15 10 11 29
8956 5 2 2 4 2 2 15 12 13 31
8960 5 2 2 8 2 3 0 0 17 5
8962 5 2 2 10 2 3 0 2 19 7
8989 5 2 5 1 2 3 1 13 13 19
9004 5 2 6 4 2 3 2 12 17 19
9017 5 2 7 5 2 3 3 9 19 17
9026 5 2 8 2 2 3 4 2 17 11
9028 5 2 8 4 2 3 4 4 19 13
9032 5 2 8 8 2 3 4 8 23 17
9043 5 2 9 7 2 3 5 3 23 13
9077 5 3 0 5 2 3 7 5 13 17
9083 5 3 0 11 2 3 7 11 19 23
9088 5 3 1 4 2 3 8 0 13 13
9092 5 3 1 8 2 3 8 4 17 17
9094 5 3 1 10 2 3 8 6 19 19
9149 5 3 6 5 2 3 11 13 19 29
9158 5 3 7 2 2 3 12 6 17 23
9164 5 3 7 8 2 3 12 12 23 29
9169 5 3 8 1 2 3 13 1 17 19
9203 5 3 10 11 2 3 15 3 29 23
9229 5 4 1 1 2 4 0 13 11 19
9242 5 4 2 2 2 4 1 10 13 17
9253 5 4 3 1 2 4 2 5 13 13
9257 5 4 3 5 2 4 2 9 17 17
9259 5 4 3 7 2 4 2 11 19 19
9263 5 4 3 11 2 4 2 15 23 23
9268 5 4 4 4 2 4 3 4 17 13
9274 5 4 4 10 2 4 3 10 23 19
9281 5 4 5 5 2 4 4 1 19 11
9296 5 4 6 8 2 4 5 0 23 11
9359 5 4 11 11 2 4 8 15 31 29
9374 5 5 1 2 2 4 9 14 13 29
9389 5 5 2 5 2 4 10 13 17 29
9391 5 5 2 7 2 4 10 15 19 31
9406 5 5 3 10 2 4 11 14 23 31
9413 5 5 4 5 2 4 12 5 19 23
9424 5 5 5 4 2 4 13 0 19 19
9428 5 5 5 8 2 4 13 4 23 23
9472 5 5 9 4 2 5 0 0 23 7
9478 5 5 9 10 2 5 0 6 29 13
9491 5 5 10 11 2 5 1 3 31 11
9506 5 6 0 2 2 5 2 2 13 11
9512 5 6 0 8 2 5 2 8 19 17
9521 5 6 1 5 2 5 3 1 17 11
9523 5 6 1 7 2 5 3 3 19 13
9527 5 6 1 11 2 5 3 7 23 17
9538 5 6 2 10 2 5 4 2 23 13
9578 5 6 6 2 2 5 6 10 19 23
9589 5 6 7 1 2 5 7 5 19 19
9593 5 6 7 5 2 5 7 9 23 23
9599 5 6 7 11 2 5 7 15 29 29
9604 5 6 8 4 2 5 8 4 23 19
9623 5 6 9 11 2 5 9 7 31 23
9632 5 6 10 8 2 5 10 0 29 17
9634 5 6 10 10 2 5 10 2 31 19
9649 5 7 0 1 2 5 11 1 13 19
9653 5 7 0 5 2 5 11 5 17 23
9659 5 7 0 11 2 5 11 11 23 29
9664 5 7 1 4 2 5 12 0 17 19
9721 5 7 6 1 2 5 15 9 19 31
9731 5 7 6 11 2 6 0 3 29 11
9758 5 7 9 2 2 6 1 14 23 23
9769 5 7 10 1 2 6 2 9 23 19
9788 5 7 11 8 2 6 3 12 31 23
9818 5 8 2 2 2 6 5 10 17 23
9829 5 8 3 1 2 6 6 5 17 19
9842 5 8 4 2 2 6 7 2 19 17
9857 5 8 5 5 2 6 8 1 23 17
9863 5 8 5 11 2 6 8 7 29 23
9874 5 8 6 10 2 6 9 2 29 19
9901 5 8 9 1 2 6 10 13 23 31
9929 5 8 11 5 2 6 12 9 29 29
9931 5 8 11 7 2 6 12 11 31 31
9961 5 9 2 1 2 6 14 9 17 31
9967 5 9 2 7 2 6 14 15 23 37
9974 5 9 3 2 2 6 15 6 19 29
779 779/9900 (approx. 0.07868686868686868)
The program, in the Frink programming language:
ct=0
for x = 100 to 9999
{
totDuo=0; totHex=0
dw=x; hw=x;dRep="";hRep=""
while dw>0
{
dig = dw mod 12; dw = dw div 12
totDuo=totDuo+dig
dRep="$dig "+dRep
}
while hw>0
{
dig = hw mod 16; hw = hw div 16
totHex=totHex+dig
hRep="$dig "+hRep
}
if isPrime[totDuo] and isPrime[totHex] and totDuo<>1 and totHex<>1
{
println[padRight["$x",7," "]+padRight[dRep,13," "]+padRight[hRep,13," "]+"$totDuo $totHex"]
ct=ct+1
}
}
prob=ct/9900
println["$ct"+" "+"$prob"]
|
Posted by Charlie
on 2011-04-07 16:04:26 |