Square-free integers: Difference between revisions

Content added Content deleted
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=: 1 :' #~ u' NB. filter right arg using verb to left
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:'''