This is my attempt at parallel programming but it did not produce the same result as serial programming.

```
function mysquare(x::Float64)
return x*x
end
function main()
Result = Tuple[]
for x in 1.0:100.0
y = mysquare(x)
push!(Result,(x,y))
end
SortedResult = sort(Result,lt=(x,y)->x[2]<y[2],rev=true)
println(SortedResult[1])
println(VERSION)
end
main()
```

with output

```
(100.0, 10000.0)
1.0.3
```

But my parallel attempt has failed to produce the same output

```
using SharedArrays
using Distributed
addprocs(4)
@everywhere function mysquare(x::Float64)
return x*x
end
function main()
Result = SharedArray{Float64,2}((100,2))
@distributed for x in 1.0:100.0
n = Int64(x)
y = mysquare(x)
Result[n,1] = x
Result[n,2] = y
end
TupleResult = [ (Result[n,1],Result[n,2]) for n in 1:100 ]
SortedResult = sort(TupleResult,lt=(x,y)->x[2]<y[2],rev=true)
println(SortedResult[1])
println(VERSION)
end
main()
```

Output

```
(0.0, 0.0)
1.0.3
```

I am not sure where I went wrong, I double check all my code and it looked correct.