Advertisement
Guest User

multiples.hoon

a guest
Dec 12th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. :: The sum of multiples of 3 and 5 below 1000 is 233.168
  2. :: Solved with `+multiples 1.000`
  3.  
  4. |= n=@
  5. =/ i=@ 1
  6. =/ sum=@ 0
  7. |-
  8. ?: =(i n)
  9. sum
  10. ?: ?|(=((mod i 3) 0) =((mod i 5) 0))
  11. $(i +(i), sum (add sum i))
  12. $(i +(i))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement