Skip to content

Instantly share code, notes, and snippets.

@steinelu
Created June 7, 2021 16:27
Show Gist options
  • Save steinelu/69a3ee24d2ef9a9a4c2967c0ec6294d3 to your computer and use it in GitHub Desktop.
Save steinelu/69a3ee24d2ef9a9a4c2967c0ec6294d3 to your computer and use it in GitHub Desktop.
function foo(n::UInt)
if n == 1 || n == 0
return n
end
if n%2 == 0
return 4 * foo(UInt(n/2))
else
return 4 * foo(UInt(floor(n/2))) + 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment