From 85b66f8e64576ec3a17066bb1b920a5cd02a30c2 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Wed, 23 Jun 2021 14:48:30 +0200 Subject: problem 73 in julia --- c/012-highly_divisible_triangular_number.c | 2 +- julia/073-counting_fractions_in_a_range.jl | 33 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 julia/073-counting_fractions_in_a_range.jl diff --git a/c/012-highly_divisible_triangular_number.c b/c/012-highly_divisible_triangular_number.c index 4ece373..c25f37d 100644 --- a/c/012-highly_divisible_triangular_number.c +++ b/c/012-highly_divisible_triangular_number.c @@ -15,7 +15,7 @@ int count_divisors(int nb) int i, div_nb = 0; for (i = 1; i <= sqrt(nb); i++) { if (nb % i == 0) - div_nb += (i != nb / i ? 2 : 1); + div_nb += (i != nb / i ? 2 : 1); // how the hell did I get there? eddie woo } return div_nb; } diff --git a/julia/073-counting_fractions_in_a_range.jl b/julia/073-counting_fractions_in_a_range.jl new file mode 100644 index 0000000..5ec6c21 --- /dev/null +++ b/julia/073-counting_fractions_in_a_range.jl @@ -0,0 +1,33 @@ +### +# Counting fractions in a range +# Problem 73 +# +# Consider the fraction, n/d, where n and d are positive integers. If n