1.Find the minimum sum of three 3digit primes, using all nonzero digits.
2.What is the smallest possible sum of primes which are formed using each of the digits 1 through 9?
Part 1:
I don't think this is what is meant, but it literally fits the description: 113 + 127 + 131 = 371. All the digits are nonzero. But that's too easy, just using the first three 3digit primes that lack zeros, which is why I don't think it's what's wanted.
I think what was wanted was that all nine nonzero digits would be used exactly once. In that case:
10 Nbrs="123456789":H$=Nbrs:Smallest=9999
15 repeat
20 P1=val(mid(Nbrs,1,3))
30 P2=val(mid(Nbrs,4,3))
40 P3=val(mid(Nbrs,7,3))
50 if prmdiv(P1)=P1 and prmdiv(P2)=P2 and prmdiv(P3)=P3 then print P1;P2;P3,P1+P2+P3:if P1+P2+P3<Smallest then Smallest=P1+P2+P3:Sp1=P1:Sp2=P2:Sp3=P3
60 gosub *Permute(&Nbrs)
70 until Nbrs=H$
75 print Sp1;Sp2;Sp3,Smallest
80 end
finds that the smallest sum is:
149 + 263 + 587 = 999
A slight modification of the program lists all sets that add up to 999, and the result is only the six permutations of these three primes, so this set is basically unique.
Part 2:
This would have to be 2+3+5+41+89+67=207, where each singledigit prime and odd nonprime is in the units position and each nonprime even digit is in the tens position, as they could not be in the units position and still allow their number to be prime, so there are no digits in the hundreds position.

Posted by Charlie
on 20120804 14:17:12 