Last active
December 17, 2018 13:53
-
-
Save p1scescom/6ed2964fa2aa3fd8fc49c90e55a8d2dc to your computer and use it in GitHub Desktop.
tak julia script ver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module M | |
global c = 0 | |
function tak(x::Int,y::Int,z::Int)::Int | |
global c += 1 | |
if x <= y | |
y | |
else tak(tak(x-1,y,z), tak(y-1,z,x), tak(z-1,x,y)) | |
end | |
end | |
function julia_main() | |
t = tak(12,6,0) | |
println("tak(12,6,0) = $t") | |
println("c = $c") | |
return 0 | |
end | |
julia_main() | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module M | |
global c = 0 | |
function tak(x::Int,y::Int,z::Int)::Int | |
global c += 1 | |
if x <= y | |
y | |
else tak(tak(x-1,y,z), tak(y-1,z,x), tak(z-1,x,y)) | |
end | |
end | |
Base.@ccallable function julia_main(ARGS::Vector{String})::Cint | |
t = tak(12,6,0) | |
println("tak(12,6,0) = $t") | |
println("c = $c") | |
return 0 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment