Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :: the sum of the multiples of 3 or 5 below 1.000 is 233.168
- :: which can be confirmed by running the below %say generator
- ::
- |%
- ++ thousand (sumthreefive 1.000)
- ++ sumthreefive
- |= end=@ud
- =/ count=@ud 1
- =/ sum=@ud 0
- |-
- ^- @ud
- ?: =(end count)
- sum
- ?: ?| =(0 (mod count 3))
- =(0 (mod count 5))
- ==
- $(count (add 1 count), sum (add sum count))
- $(count (add 1 count))
- --
- :- %say
- |= *
- :- %noun
- thousand
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement