Nth root of number

JavaScript, Math · Jan 6, 2021

Calculates the nth root of a given number.

  • Use Math.pow() to calculate x to the power of 1 / n which is equal to the nth root of x.
const nthRoot = (x, n) => Math.pow(x, 1 / n);

nthRoot(32, 5); // 2

More like this

  • Percentile of matches

    Calculates the percentage of numbers in the given array that are less or equal to the given value.

    JavaScript, Math · Oct 22, 2020

  • Sum of powers in range

    Calculates the sum of the powers of all the numbers from start to end (both inclusive).

    JavaScript, Math · Oct 22, 2020

  • Prime factors of number

    Finds the prime factors of a given number using the trial division algorithm.

    JavaScript, Math · Dec 28, 2020