Problem 1858. User defined nextpow function
Create a function which will take 2 arguments as n and x, and return y, where, n^y >= abs(x). [ Similar to builtin "nextpow2" function]
e.g. nextpow(3, 20) will return 3 since 3^3 =27 > 20
Another example: nextpow(4, 16) will return 2, since 4^2 = 16
nextpow(2, 21) will return 5, since 2^5 = 32 > 21
Solution Stats
Problem Comments
-
1 Comment
Tanisha
on 12 Jul 2022
Interesting question!
Solution Comments
Show commentsProblem Recent Solvers83
Suggested Problems
-
Extract leading non-zero digit
2178 Solvers
-
Project Euler: Problem 6, Natural numbers, squares and sums.
2324 Solvers
-
9544 Solvers
-
Create a vector whose elements depend on the previous element
713 Solvers
-
1512 Solvers
More from this Author25
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!