Skip to content

Instantly share code, notes, and snippets.

@xjia1
Last active December 20, 2015 18:18
Show Gist options
  • Save xjia1/6174584 to your computer and use it in GitHub Desktop.
Save xjia1/6174584 to your computer and use it in GitHub Desktop.
Computing the integer square root of n
k = 0
j = 1
m = 1
while m <= n
k = k + 1
j = j + 2
m = m + j
end
# the answer is in k
@xjia1
Copy link
Author

xjia1 commented Aug 7, 2013

j = 1 3 5 7 9 ...
m = 1 4 9 16 25 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment