Advertisement
sevenish

assignment4

Dec 8th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. :: the sum of the multiples of 3 or 5 below 1.000 is 233.168
  2. :: which can be confirmed by running the below %say generator
  3. ::
  4. |%
  5. ++ thousand (sumthreefive 1.000)
  6. ++ sumthreefive
  7. |= end=@ud
  8. =/ count=@ud 1
  9. =/ sum=@ud 0
  10. |-
  11. ^- @ud
  12. ?: =(end count)
  13. sum
  14. ?: ?| =(0 (mod count 3))
  15. =(0 (mod count 5))
  16. ==
  17. $(count (add 1 count), sum (add sum count))
  18. $(count (add 1 count))
  19. --
  20. :- %say
  21. |= *
  22. :- %noun
  23. thousand
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement