Square root algorithm