Calmo numbers: Difference between revisions
Content added Content deleted
(J draft) |
|||
Line 284: | Line 284: | ||
957 [3 11 29 33 87 319] [43 439] |
957 [3 11 29 33 87 319] [43 439] |
||
</pre> |
</pre> |
||
=={{header|J}}== |
|||
If we ignore 1 and primes (see [[Talk:Calmo_numbers#Edge_cases|talk page]]): |
|||
<syntaxhighlight lang=J> isCalmo=: {{*/((,*)+/)1 p:}:_3+/\/:~_ _ _,~.}.}:*/@>,{1 ,&.>q:y}} ::0:"0 |
|||
I.isCalmo i.1000 |
|||
165 273 385 399 561 595 665 715 957 |
|||
</syntaxhighlight> |
|||
(This implementation relies on infinity not being specifically prime nor non-prime, and on treating the error case as "not a Calmo number"). |
|||
=={{header|Julia}}== |
=={{header|Julia}}== |