Square-free integers: Difference between revisions
Content added Content deleted
(→{{header|J}}: Add J) |
m (→{{header|J}}) |
||
Line 658: | Line 658: | ||
=={{header|J}}== |
=={{header|J}}== |
||
'''Solution:''' |
'''Solution:''' |
||
<lang j>isSqrFree=: (#@~. = #)@q: NB. are there no duplicates in the prime factors of a number? |
<lang j>isSqrFree=: (#@~. = #)@q: NB. are there no duplicates in the prime factors of a number? |
||
filter=: |
filter=: adverb def ' #~ u' NB. filter right arg using verb to left |
||
countSqrFree=: +/@:isSqrFree |
countSqrFree=: +/@:isSqrFree |
||
thru=: <. + i.@(+ *)@-~ NB. helper verb</lang> |
thru=: <. + i.@(+ *)@-~ NB. helper verb</lang> |
||
'''Required Examples:''' |
'''Required Examples:''' |