RosettaCodeData/Task/Additive-primes/Phix/additive-primes.phix
2026-02-01 16:33:20 -08:00

4 lines
249 B
Text

with javascript_semantics
function additive(string p) return is_prime(sum(sq_sub(p,'0'))) end function
sequence res = filter(apply(get_primes_le(500),sprint),additive)
printf(1,"%d additive primes found: %s\n",{length(res),join(shorten(res,"",6))})