From 4d53ec2b825fdc56ea221cab5df580824734ea68 Mon Sep 17 00:00:00 2001 From: daviddoji Date: Fri, 7 Oct 2022 21:36:07 +0200 Subject: [PATCH] Linting --- src/Julia/Problems001-050/Problem008.jl | 14 +++++++------- src/Julia/Problems001-050/Problem009.jl | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Julia/Problems001-050/Problem008.jl b/src/Julia/Problems001-050/Problem008.jl index 55020cc..610c3b6 100644 --- a/src/Julia/Problems001-050/Problem008.jl +++ b/src/Julia/Problems001-050/Problem008.jl @@ -19,7 +19,7 @@ function Problem8() Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product? =# - NUM = """ + NUM::String = """ 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 @@ -42,14 +42,14 @@ function Problem8() 71636269561882670428252483600823257530420752963450 """ - num = replace(NUM, "\n" => "") - adjacent_digits = 13 - target = length(num) - adjacent_digits - ans, i = 0, 1 + num::String = replace(NUM, "\n" => "") + adjacent_digits::Int16 = 13 + target::Int32 = length(num) - adjacent_digits + ans::Int64, i::Int64 = 0, 1 while i < target - a, j = 1, i + a::Int64, j::Int64 = 1, i while j < (i + adjacent_digits) - a = a * parse(Int, (num[j])) + a *= parse(Int, (num[j])) j += 1 end if a > ans diff --git a/src/Julia/Problems001-050/Problem009.jl b/src/Julia/Problems001-050/Problem009.jl index 865107c..81c7942 100644 --- a/src/Julia/Problems001-050/Problem009.jl +++ b/src/Julia/Problems001-050/Problem009.jl @@ -20,8 +20,8 @@ function Problem9() Find the product abc. =# upper_limit = 1000 - for a in 1:upper_limit + 1 - for b in a + 1:upper_limit + 1 + for a = 1:upper_limit+1 + for b = a+1:upper_limit+1 c = upper_limit - a - b if a * a + b * b == c * c # It is now implied that b < c, because we have a > 0