Erdős-primes: Difference between revisions

Add Factor
(julia example)
(Add Factor)
Line 8:
 
Optionally, show the '''number''' of Erdős-primes.
 
=={{header|Factor}}==
{{works with|Factor|0.99 2021-02-05}}
<lang factor>USING: formatting grouping io kernel math math.primes
prettyprint sequences ;
 
: sum-digits ( n -- sum )
0 swap [ 10 /mod rot + swap ] until-zero ;
 
499 primes-upto [ sum-digits prime? ] filter
[ 9 group simple-table. nl ]
[ length "Found %d Erdős primes < 500.\n" printf ] bi</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
 
Found 54 Erdős primes < 500.
</pre>
 
=={{header|Julia}}==
1,827

edits