Paste: project euler problem 1

Author: yoklov
Mode: factor
Date: Sat, 5 May 2012 19:54:53
Plain Text |
! project euler problem 1:
! find the sum of all multiples of 3 or 5 below 1000

: div3or5? ( x -- ? ) [ 3 mod ] [ 5 mod ] bi [ zero? ] bi@ or ;

: problem1 ( n -- sol ) iota [ div3or5? ] filter sum ;

! 1000 problem1 .
! => 223168

New Annotation

Summary:
Author:
Mode:
Body: