Jump to content

Calmo numbers: Difference between revisions

J draft
(J draft)
Line 284:
957 [3 11 29 33 87 319] [43 439]
</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}}==
6,962

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.