aboutsummaryrefslogtreecommitdiff
path: root/problem73.erl
diff options
context:
space:
mode:
authorNathan Lasseter <nathan.je.lasseter@googlemail.com>2009-10-04 00:56:56 +0100
committerNathan Lasseter <nathan.je.lasseter@googlemail.com>2009-10-04 00:56:56 +0100
commit0248ed34ce3d05228bc5084669c3a27933be0c2e (patch)
treeb9c4990344b0863a2af851b5917c49f3a5f03e6b /problem73.erl
parent00686037d57eb0a0d5eba6eeb6fcc9692e8b59f6 (diff)
first commit
Diffstat (limited to 'problem73.erl')
-rwxr-xr-xproblem73.erl12
1 files changed, 12 insertions, 0 deletions
diff --git a/problem73.erl b/problem73.erl
new file mode 100755
index 0000000..6b20bb7
--- /dev/null
+++ b/problem73.erl
@@ -0,0 +1,12 @@
+-module(problem73).
+-export([solve/0]).
+
+solve() ->
+ length([ X || X <- genlist(), X > 1/3, X < 1/2]).
+
+genlist() ->
+ O = lists:seq(1,10000),
+ [ N / D || N <- O, D <- O, N < D, gcd(N,D) =:= 1 ].
+
+gcd(A, 0) -> A;
+gcd(A, B) -> gcd(B, A rem B).