Numbers with prime digits whose sum is 13: Difference between revisions
Content added Content deleted
m (added to Prime Numbers category.) |
Drkameleon (talk | contribs) (Added Arturo implementation) |
||
Line 47: | Line 47: | ||
52222 222223 222232 222322 223222 232222 322222 |
52222 222223 222232 222322 223222 232222 322222 |
||
</pre> |
</pre> |
||
=={{header|Arturo}}== |
|||
<lang rebol>pDigits: [2 3 5 7] |
|||
lst: map pDigits 'd -> @[d] |
|||
result: new [] |
|||
while [0 <> size lst][ |
|||
nextList: new [] |
|||
loop lst 'digitSeq [ |
|||
currSum: sum digitSeq |
|||
loop pDigits 'n [ |
|||
newSum: currSum + n |
|||
newDigitSeq: digitSeq ++ n |
|||
case [newSum] |
|||
when? [<13] -> 'nextList ++ @[newDigitSeq] |
|||
when? [=13] -> 'result ++ @[to :integer join to [:string] newDigitSeq] |
|||
else -> break |
|||
] |
|||
] |
|||
lst: new nextList |
|||
] |
|||
loop split.every: 10 result 'a -> |
|||
print map a => [pad to :string & 6]</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|AWK}}== |
=={{header|AWK}}== |
||
<lang AWK> |
<lang AWK> |