added julia implementation for problem 6
This commit is contained in:
parent
b725343392
commit
447f5ebd77
1 changed files with 17 additions and 0 deletions
17
e0006/euler0006.jl
Normal file
17
e0006/euler0006.jl
Normal file
|
@ -0,0 +1,17 @@
|
|||
#/usr/bin/julia
|
||||
|
||||
function sumOfSquares(x)
|
||||
sum(x.^2)
|
||||
end
|
||||
|
||||
function squareOfSum(x)
|
||||
sum(x)^2
|
||||
end
|
||||
|
||||
function euler0006(x)
|
||||
seq=1:x
|
||||
squareOfSum(seq) - sumOfSquares(seq)
|
||||
end
|
||||
|
||||
euler0006(1)
|
||||
@time euler0006(100)
|
Reference in a new issue