Put Redanant code into single function

(24.n* + 1).sqrt() was called 3 times in code, so I repalced it with a single function call. 

Better style I guess?