Numbers with prime digits whose sum is 13: Difference between revisions

Line 1,579:
[337,355,373,535,553,733,2227,2272,2335,2353,2533,2722,3235,3253,3325,3352,3523,3532,5233,5323,5332,7222,22225,22252,22333,22522,23233,23323,23332,25222,32233,32323,32332,33223,33232,33322,52222,222223,222232,222322,223222,232222,322222]
</pre>
 
=={{header|Ruby}}==
{{trans|C}}
<lang ruby>def primeDigitsSum13(n)
sum = 0
while n > 0
r = n % 10
if r != 2 and r != 3 and r != 5 and r != 7 then
return false
end
n = (n / 10).floor
sum = sum + r
end
return sum == 13
end
 
c = 0
for i in 1 .. 1000000
if primeDigitsSum13(i) then
print "%6d " % [i]
if c == 10 then
c = 0
print "\n"
else
c = c + 1
end
end
end
print "\n"
</lang>
{{out}}
<pre> 337 355 373 535 553 733 2227 2272 2335 2353 2533
2722 3235 3253 3325 3352 3523 3532 5233 5323 5332 7222
22225 22252 22333 22522 23233 23323 23332 25222 32233 32323 32332
33223 33232 33322 52222 222223 222232 222322 223222 232222 322222</pre>
 
=={{header|Visual Basic .NET}}==
1,452

edits