Implement log2 function with Math.sqrt, which took me a long time to understand how sqrt can be used here.