« first day (818 days earlier)      last day (717 days later) » 

00:46
My solution to Project Euler #1 in k9 (https://projecteuler.net/problem=1)
/ If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
/ Find the sum of all the multiples of 3 or 5 below 1000.

`+/&{(~3 mod!x)|~5 mod!x}1000`

Any suggestions on ways to do it faster or shorter?
+/&|/0=3 5 mod\:!1000
Thanks!
+/1 1 -1*{_y*.5*n*1+n:_(x-1)%y}/:[1000;3 5 15]
faster mathematical approach
01:13
Wow! I think I get it. For each factor f in {3,5}, let n be the number of multiples of f from 1 through 999 (inclusive), calculated as n = floor[999/f]. The sum of those multiples will look like f + 2f + 3f + ... + nf. Factoring out f from each term yields f(1+2+3+...+n) ,which equals f(n(n+1)/2).
We then add up the sum for each f, but this double-counts numbers that are multiples of both 3 and 5, i.e., multiples of 15, so we subtract the multiples of 15. The first two sums (multiples of 3 and 5) are added, and the third (15) is subtracted. That's done with the 1 1 -1 near the beginning, which corresponds to the 3 5 15 at the end.

« first day (818 days earlier)      last day (717 days later) »