Arithmetic numbers: Difference between revisions
m
→{{header|J}}: example goes in example section, also it's faster to not test numbers larger than a million
m (J: bugfix -- 1 is not composite) |
m (→{{header|J}}: example goes in example section, also it's faster to not test numbers larger than a million) |
||
Line 84:
<lang J>factors=: {{ */@>,{(^ [:i.1+])&.>/__ q:y}}
isArith=: {{ (= <.) (+/%#) factors y}}"0</lang>
Task examples:
<lang J>example=:
10 10$example
1 3 5 6 7 11 13 14 15 17
19 20 21 22 23 27 29 30 31 33
|