Skip to main content
added explanation
Source Link
ETHproductions
  • 50.1k
  • 6
  • 94
  • 240

Japt, 9 bytes

_q}a@nVpX

Test it online!

Explanation

_  q}a@  nVpX
Z{Zq}aX{UnVpX}  // Ungolfed
                // Implicit: U, V = input integers
     aX{     }  // For each integer X in [0...1e9), take
          VpX   //   V to the power of X
        Un      //   minus U,
Z{  }           // and return the first one Z where
  Zq            //   Math.sqrt(Z) is truthy.
                //   Math.sqrt returns NaN for negative inputs, and 0 is falsy, so this is
                //   truthy iff Z is positive. Therefore, this returns the first positive
                //   value of V**X - U.
                // Implicit: output result of last expression

Japt, 9 bytes

_q}a@nVpX

Test it online!

Japt, 9 bytes

_q}a@nVpX

Test it online!

Explanation

_  q}a@  nVpX
Z{Zq}aX{UnVpX}  // Ungolfed
                // Implicit: U, V = input integers
     aX{     }  // For each integer X in [0...1e9), take
          VpX   //   V to the power of X
        Un      //   minus U,
Z{  }           // and return the first one Z where
  Zq            //   Math.sqrt(Z) is truthy.
                //   Math.sqrt returns NaN for negative inputs, and 0 is falsy, so this is
                //   truthy iff Z is positive. Therefore, this returns the first positive
                //   value of V**X - U.
                // Implicit: output result of last expression
Source Link
ETHproductions
  • 50.1k
  • 6
  • 94
  • 240

Japt, 9 bytes

_q}a@nVpX

Test it online!