Skip to content

Instantly share code, notes, and snippets.

@mbeltagy
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbeltagy/129a584c21ce56ac3b60 to your computer and use it in GitHub Desktop.
Save mbeltagy/129a584c21ce56ac3b60 to your computer and use it in GitHub Desktop.
Monkeys and Coconuts
x=zeros(Float64,5)
maxmultiple=1000
for m=1:maxmultiple
x[5]=4*5*m #It has to be divisalbe by 4 and 5
for i=4:-1:1
x[i]=5x[i+1]/4+1
end
x0=x[1]*5/4+1
if isinteger(x)&&isinteger(x0)
println(int(x))
println("m=$m, x₀= $(int(x0))")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment