Skip to content

Instantly share code, notes, and snippets.

@seaslee
Created October 24, 2012 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seaslee/3945958 to your computer and use it in GitHub Desktop.
Save seaslee/3945958 to your computer and use it in GitHub Desktop.
solution to problem 2 of euler project
function y=ep2(n)
%exhaustive method
a=1;
b=2;
y=2;
c=a+b;
a=b;
b=c;
while c<=n,
if mod(c,2)==0,
y=y+c;
end
c=a+b;
a=b;
b=c;
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment