1.Find the minimum sum of three 3-digit primes, using all non-zero digits.
2.What is the smallest possible sum of primes which are formed using each of the digits 1 through 9?
I don't think this is what is meant, but it literally fits the description: 113 + 127 + 131 = 371. All the digits are non-zero. But that's too easy, just using the first three 3-digit 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 non-zero digits would be used exactly once. In that case:
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
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.
This would have to be 2+3+5+41+89+67=207, where each single-digit prime and odd non-prime is in the units position and each non-prime 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 2012-08-04 14:17:12