• + 13 comments

    That's not "strange math", this is basic math. You need to understand the concept of inverse function (https://www.mathsisfun.com/sets/function-inverse.html).

    For our case, look at the graph of y = x2. For each point y of the graph, there is an x, square of which will give the graph value (y). This x can be found with inverse function, sqrt(x).

    For the interval [a,b] for y, all x which give the y point in [a,b] lay in the [sqrt(a), sqrt(b)] interval. This follows from the definitions of function and inverse function.

    So, to count all whole y from [a,b], we need just to count all whole x from [ceil(sqrt(a)), floor(sqrt(b))]. (ceil(x) gives closest high integer for x, floor(x) gives closest lower integer for x - see Topics tab). For interval [m, n] (m,n are whole, including endpoints m, n), the number of integers in it is (n - m) + 1. This gives us the solution.

    We can generalise this: all whole numbers of f(x) in [a,b] can be counted as:
    floor(f-1(b)) - ceil(f-1(a)) + 1

    Now Sherlok can easily found the number of cubes in [a,b], number of degrees of 2 in [a,b], etc, provided he has proper inverse function :).