Linting
This commit is contained in:
parent
948dfb0ff8
commit
3cf341159b
@ -15,6 +15,7 @@ function Problem13()
|
|||||||
#=
|
#=
|
||||||
Work out the first ten digits of the sum of the following one-hundred
|
Work out the first ten digits of the sum of the following one-hundred
|
||||||
50-digit numbers =#
|
50-digit numbers =#
|
||||||
|
|
||||||
return string(sum(parse.(BigInt, readlines("../files/Problem13.txt"))))[1:10]
|
return string(sum(parse.(BigInt, readlines("../files/Problem13.txt"))))[1:10]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ https://projecteuler.net/problem=14 =#
|
|||||||
|
|
||||||
using BenchmarkTools
|
using BenchmarkTools
|
||||||
|
|
||||||
function chain_length(n)# , terms)
|
function chain_length(n)
|
||||||
length = 0
|
length = 0
|
||||||
while n > 1
|
while n > 1
|
||||||
n = iseven(n) ? n >> 1 : 3n + 1
|
n = iseven(n) ? n >> 1 : 3n + 1
|
||||||
@ -42,7 +42,7 @@ function Problem14()
|
|||||||
ans = 0
|
ans = 0
|
||||||
limit = 1_000_000
|
limit = 1_000_000
|
||||||
score = 0
|
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)
|
longest = chain_length(i)
|
||||||
if longest > score
|
if longest > score
|
||||||
score = longest
|
score = longest
|
||||||
|
Loading…
x
Reference in New Issue
Block a user