Nice primes: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: added syntax colouring the hard way) |
Drkameleon (talk | contribs) (Added Arturo implementation) |
||
Line 203: | Line 203: | ||
{{output}} |
{{output}} |
||
<lang applescript>{509, 547, 563, 569, 587, 599, 601, 617, 619, 641, 653, 659, 673, 677, 691, 709, 727, 743, 761, 797, 821, 839, 853, 857, 887, 907, 911, 929, 941, 947, 977, 983, 997}</lang> |
<lang applescript>{509, 547, 563, 569, 587, 599, 601, 617, 619, 641, 653, 659, 673, 677, 691, 709, 727, 743, 761, 797, 821, 839, 853, 857, 887, 907, 911, 929, 941, 947, 977, 983, 997}</lang> |
||
=={{header|Arturo}}== |
|||
<lang rebol>sumd: function [n][ |
|||
s: sum digits n |
|||
(1 = size digits s)? -> return s |
|||
-> return sumd s |
|||
] |
|||
nice?: function [x] -> and? prime? x |
|||
prime? sumd x |
|||
loop split.every:10 select 500..1000 => nice? 'a -> |
|||
print map a => [pad to :string & 4]</lang> |
|||
{{out}} |
|||
<pre> 509 547 563 569 587 599 601 617 619 641 |
|||
653 659 673 677 691 709 727 743 761 797 |
|||
821 839 853 857 887 907 911 929 941 947 |
|||
977 983 997</pre> |
|||
=={{header|AWK}}== |
=={{header|AWK}}== |