Skip to main content
added 1 character in body
Source Link
Sundar R
  • 6.6k
  • 19
  • 33

MATL, 14 bytes

w1Y\^tkwXkh1G^

Try on MATL Online or Test all cases

w    % Get both inputs and bring P to the top of the stack
1Y\  % Take the inverse of P
^    % Raise N to that power i.e. take N's P-th root
tk   % Take a copy of that root and floor it
Xk wXk  % And ceil the original copy
h1G^ % Raise both those values to the power of P

MATL, 14 bytes

w1Y\^tkwXkh1G^

Try on MATL Online or Test all cases

w    % Get both inputs and bring P to the top of the stack
1Y\  % Take the inverse of P
^    % Raise N to that power i.e. take N's P-th root
tk   % Take a copy of that root and floor it
Xk   % And ceil the original copy
h1G^ % Raise both those values to the power of P

MATL, 14 bytes

w1Y\^tkwXkh1G^

Try on MATL Online or Test all cases

w    % Get both inputs and bring P to the top of the stack
1Y\  % Take the inverse of P
^    % Raise N to that power i.e. take N's P-th root
tk   % Take a copy of that root and floor it
wXk  % And ceil the original copy
h1G^ % Raise both those values to the power of P
Source Link
Sundar R
  • 6.6k
  • 19
  • 33

MATL, 14 bytes

w1Y\^tkwXkh1G^

Try on MATL Online or Test all cases

w    % Get both inputs and bring P to the top of the stack
1Y\  % Take the inverse of P
^    % Raise N to that power i.e. take N's P-th root
tk   % Take a copy of that root and floor it
Xk   % And ceil the original copy
h1G^ % Raise both those values to the power of P