From 3cf341159bed7d6bd2c661c110bf01f89743b669 Mon Sep 17 00:00:00 2001 From: daviddoji Date: Wed, 12 Oct 2022 20:19:06 +0200 Subject: [PATCH] Linting --- src/Julia/Problems001-050/Problem013.jl | 3 ++- src/Julia/Problems001-050/Problem014.jl | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Julia/Problems001-050/Problem013.jl b/src/Julia/Problems001-050/Problem013.jl index b8e3532..b03909e 100644 --- a/src/Julia/Problems001-050/Problem013.jl +++ b/src/Julia/Problems001-050/Problem013.jl @@ -1,4 +1,4 @@ -using Base:String +using Base: String #= Created on 22 Jul 2021 @@ -15,6 +15,7 @@ function Problem13() #= Work out the first ten digits of the sum of the following one-hundred 50-digit numbers =# + return string(sum(parse.(BigInt, readlines("../files/Problem13.txt"))))[1:10] end diff --git a/src/Julia/Problems001-050/Problem014.jl b/src/Julia/Problems001-050/Problem014.jl index 60ed98b..e32a3f5 100644 --- a/src/Julia/Problems001-050/Problem014.jl +++ b/src/Julia/Problems001-050/Problem014.jl @@ -9,13 +9,13 @@ https://projecteuler.net/problem=14 =# using BenchmarkTools -function chain_length(n)# , terms) +function chain_length(n) length = 0 while n > 1 n = iseven(n) ? n >> 1 : 3n + 1 length += 1 end -return length + return length end function Problem14() @@ -42,13 +42,13 @@ function Problem14() ans = 0 limit = 1_000_000 score = 0 - for i in 1:2:limit # no need to check even numbers + for i = 1:2:limit # no need to check even numbers longest = chain_length(i) if longest > score score = longest ans = i end -end + end return ans end