From 0248ed34ce3d05228bc5084669c3a27933be0c2e Mon Sep 17 00:00:00 2001 From: Nathan Lasseter Date: Sun, 4 Oct 2009 00:56:56 +0100 Subject: first commit --- problem73.erl | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 problem73.erl (limited to 'problem73.erl') 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). -- cgit v1.2.1