brute force with inverse function, once again