Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Approximate squaring drill
- function as(n::Int64, d::Int64)
- c = 0
- n = BigInt(n)
- d = BigInt(d)
- while d > 1
- c += 1
- x = ceil(BigInt, n / d)
- q, r = divrem(d, x)
- if r == 0
- d = q
- else
- n *= x
- end
- end
- return n, c
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement