diff options
author | Nathan Lasseter <nathan.je.lasseter@googlemail.com> | 2009-10-04 00:56:56 +0100 |
---|---|---|
committer | Nathan Lasseter <nathan.je.lasseter@googlemail.com> | 2009-10-04 00:56:56 +0100 |
commit | 0248ed34ce3d05228bc5084669c3a27933be0c2e (patch) | |
tree | b9c4990344b0863a2af851b5917c49f3a5f03e6b /problem9.erl | |
parent | 00686037d57eb0a0d5eba6eeb6fcc9692e8b59f6 (diff) |
first commit
Diffstat (limited to 'problem9.erl')
-rwxr-xr-x | problem9.erl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/problem9.erl b/problem9.erl new file mode 100755 index 0000000..2948d18 --- /dev/null +++ b/problem9.erl @@ -0,0 +1,10 @@ +-module(problem9). +-export([solve/0]). + +solve() -> + [{A,B,C}|_] = pythag(1000), + A*B*C. + +pythag(N) -> + D = lists:seq(1,N), + [{A,B,C} || A <- D, B <- D, C <- D, A+B+C=:=N, A*A+B*B=:=C*C]. |