Skip to content

Instantly share code, notes, and snippets.

@vito
Created July 30, 2010 15:05
Show Gist options
  • Save vito/500674 to your computer and use it in GitHub Desktop.
Save vito/500674 to your computer and use it in GitHub Desktop.
Project Euler solutions in The
problem-1: max = {
(0 ... max)
(filter: { n | 3 divides?: n || 5 divides?: n })
sum
} do
(problem-1: 1000) print
problem-2: max = {
sum = 0
n0 = 0
n1 = 1
while: { n1 < max }
do: {
{-sum = sum + (if: n1 even? then: { n1 } else: { 0 })-}
-- OR:
(b: Block) in-scope = { b scope do: b }
when: n1 even?
do: { sum = sum + n1 } in-scope
n1 = n1 + n0
n0 = n1 - n0
}
sum
} do
(problem-2: 4000000) print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment