Skip to content

Instantly share code, notes, and snippets.

@davepkennedy
Created June 6, 2011 11:30
Show Gist options
  • Save davepkennedy/1010096 to your computer and use it in GitHub Desktop.
Save davepkennedy/1010096 to your computer and use it in GitHub Desktop.
Euler1, Erlang style
-module(euler1).
-export([sum/1]).
sum(0) -> 0;
sum(X) when X rem 3 == 0 -> X + sum(X-1);
sum(X) when X rem 5 == 0 -> X + sum(X-1);
sum(X) -> sum(X-1).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment