Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/Additive-primes/Phixmonti/additive-primes.phixmonti
Normal file
26
Task/Additive-primes/Phixmonti/additive-primes.phixmonti
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/# 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue