For a change my k solution is more wordy because the mod function is rather long. Said that, the q above has k in it as well. In pure q it would read
q)sum where 0=min mod/:[;3 5]til 1000
terse and somewhat obfuscated, though the main elements are recognizable, i.e. create the list up to 1000, compute the remainders when dividing by 3 and by 5 and sum across all where either remainder is 0.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
k) +/&0=min{x-y*x div y}/:[;3 5](!)1000
For a change my k solution is more wordy because the mod function is rather long. Said that, the q above has k in it as well. In pure q it would read
q)sum where 0=min mod/:[;3 5]til 1000
terse and somewhat obfuscated, though the main elements are recognizable, i.e. create the list up to 1000, compute the remainders when dividing by 3 and by 5 and sum across all where either remainder is 0.