This works for me, both in Julia 0.3 and 0.4
julia function fib_sum_2(x,y,z)
sum(x:x:z) + sum(y:y:z) - sum(lcm(x,y):lcm(x,y):z)
end
fib_sum_2 (generic function with 1 method)
julia fib_sum_2(3,5,999)
233168
What happens if you restart Julia and try again?
On Monday, May
Thank you. I said this in the post below, but is this an issue with Julia
going forward? The need to restart.
On Monday, May 18, 2015 at 10:50:28 AM UTC-4, Kristoffer Carlsson wrote:
This works for me, both in Julia 0.3 and 0.4
julia function fib_sum_2(x,y,z)
sum(x:x:z) +
(or use `workspace()`)
On Mon, May 18, 2015 at 11:56 AM, Jameson Nash vtjn...@gmail.com wrote:
at some point you probably entered something like:
sum = 5
from that point on, sum refers to 5, rather than the Base.sum function.
you could restore it by typing
sum = Base.sum
or just restart
You probably did this:
julia x = rand(3)
3-element Array{Float64,1}:
0.203537
0.0976039
0.425243
julia sum = 5 # you just borked sum
5
julia sum(x)
ERROR: type: apply: expected Function, got Int64
But notice sum is still there:
julia Base.sum(x)
0.7263840892398132
julia sum = Base.sum
at some point you probably entered something like:
sum = 5
from that point on, sum refers to 5, rather than the Base.sum function.
you could restore it by typing
sum = Base.sum
or just restart
On Mon, May 18, 2015 at 11:37 AM James Byars jimmyby...@gmail.com wrote:
Thank you. I said this in