diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-06-20 20:10:05 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-06-20 20:10:05 +0200 |
| commit | e794020d8b881ede726338be50eaa461a134889f (patch) | |
| tree | 99f32380378fa6813d7ccf15b56d8b48fcd263c2 /julia/006-sum_square_difference.jl | |
| parent | 16a3e5fc6728f1c0d414983f6e1fc3fc160034b3 (diff) | |
| download | project_euler-e794020d8b881ede726338be50eaa461a134889f.tar.gz project_euler-e794020d8b881ede726338be50eaa461a134889f.tar.bz2 project_euler-e794020d8b881ede726338be50eaa461a134889f.zip | |
Refactoging julia problems with function chainning
Diffstat (limited to 'julia/006-sum_square_difference.jl')
| -rw-r--r-- | julia/006-sum_square_difference.jl | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/julia/006-sum_square_difference.jl b/julia/006-sum_square_difference.jl index 39e5df8..fd5829d 100644 --- a/julia/006-sum_square_difference.jl +++ b/julia/006-sum_square_difference.jl @@ -12,9 +12,6 @@ # numbers and the square of the sum. ### -const count = 100 - -sum_of_squares = sum(x ^ 2 for x in 1:count) -square_of_sum = sum(1:count) ^ 2 - -println(square_of_sum - sum_of_squares) +const COUNT = 100 +result = sum(1:COUNT) ^ 2 - sum(x ^ 2 for x in 1:COUNT) +println(result) |
