Additive primes: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 2,176: | Line 2,176: | ||
54 additive primes found: 2 3 5 7 11 23 ... 443 449 461 463 467 487 |
54 additive primes found: 2 3 5 7 11 23 ... 443 449 461 463 467 487 |
||
</pre> |
</pre> |
||
=={{header|Phixmonti}}== |
|||
<lang Phixmonti>/# Rosetta Code problem: http://rosettacode.org/wiki/Additive_primes |
|||
by Galileo, 05/2022 #/ |
|||
include ..\Utilitys.pmt |
|||
def isprime |
|||
dup 1 <= if drop false |
|||
else dup 2 == not if |
|||
( dup sqrt 2 swap ) for |
|||
over swap mod not if drop false exitfor endif |
|||
endfor |
|||
endif |
|||
endif |
|||
false == not |
|||
enddef |
|||
def digitsum |
|||
0 swap dup 0 > while dup 10 mod rot + swap 10 / int dup 0 > endwhile |
|||
drop |
|||
enddef |
|||
0 500 for |
|||
dup isprime over digitsum isprime and if print " " print 1 + else drop endif |
|||
endfor |
|||
"Additive primes found: " print print |
|||
</lang> |
|||
{{out}} |
|||
<pre>2 3 5 7 11 23 29 41 43 47 61 67 83 89 101 113 131 137 139 151 157 173 179 191 193 197 199 223 227 229 241 263 269 281 283 311 313 317 331 337 353 359 373 379 397 401 409 421 443 449 461 463 467 487 Additive primes found: 54 |
|||
=== Press any key to exit ===</pre> |
|||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |