Nice primes: Difference between revisions

(→‎{{header|ALGOL 68}}: Use Algol 68-primes)
Line 882:
33 nice primes found.</pre>
 
=={{header|jq}}==
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
 
This entry uses `is_prime` as defined at
[[Erd%C5%91s-primes#jq]].
<lang jq>def is_nice:
# input: a non-negative integer
def sumn:
. as $in
| tostring
| if length == 1 then $in
else explode | map([.] | implode | tonumber) | add | sumn
end;
 
is_prime and (sumn|is_prime);
 
# The task:
range(501; 1000) | select(is_nice)</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|Julia}}==
See [[Strange_numbers#Julia]] for the filter_open_interval function.
2,489

edits