Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :: Find the sum of all the multiples of 3 or 5 below n (NOT including n).
- ::
- |= n=@ud
- =/ i=@ 0
- =/ sum=@ 0
- ^- @ud
- |-
- :: ~& [i sum] :: for debugging
- ?: =(i n)
- sum
- ?: ?|(=(0 (mod i 3)) =(0 (mod i 5)))
- $(i +(i), sum (add i sum))
- $(i +(i))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement