Numbers with prime digits whose sum is 13: Difference between revisions
Numbers with prime digits whose sum is 13 (view source)
Revision as of 06:07, 13 January 2022
, 2 years agoAdded 11l
(Added solution for Action!) |
Alextretyak (talk | contribs) (Added 11l) |
||
Line 2:
Find all the positive integers whose decimal digits are all primes and sum to '''13'''.
<br><br>
=={{header|11l}}==
{{trans|C}}
<lang 11l>F primeDigitsSum13(=n)
V sum = 0
L n > 0
V r = n % 10
I r !C (2, 3, 5, 7)
R 0B
n I/= 10
sum += r
R sum == 13
V c = 0
L(i) 1..999999
I primeDigitsSum13(i)
print(‘#6’.format(i), end' ‘ ’)
I ++c == 11
c = 0
print()
print()</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|Action!}}==
|