6 kyu
Nth Root of a Number Redux
182 of 219bkaes
Description:
Part of Series 2/3
This kata is part of a series on computing the nth root of a number. It was inspired by [Nth Root of a Number][series-1] by [@afonsomatos][afonso]. Make sure you solve the [previous part][series-1] before you try this one.
Task
Given two numbers x
and n
, calculate the nth root of x, e.g. r
such that r^n = x
. However, you're working with some kind of legacy API that doesn't contain a helpful function for this task (see end of the description).
Examples
root(4, 2); // 2
root(8, 3); // 2
root(256, 4); // 4
root(9, 2); // 3
Disabled functions
Spoilers ahead!
The following description contains hints on another kata. Make sure that you've solved [the previous part of the series][series-1] before you read the next part.
The power function of your language (e.g. Math.pow
in JavaScript, **
in Haskell) has been disabled. Good luck.
Mathematics
Fundamentals
Similar Kata:
Stats:
Created | Apr 9, 2015 |
Published | Apr 9, 2015 |
Warriors Trained | 1220 |
Total Skips | 351 |
Total Code Submissions | 1902 |
Total Times Completed | 219 |
JavaScript Completions | 182 |
Haskell Completions | 47 |
Total Stars | 18 |
% of votes with a positive feedback rating | 86% of 63 |
Total "Very Satisfied" Votes | 48 |
Total "Somewhat Satisfied" Votes | 12 |
Total "Not Satisfied" Votes | 3 |