Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

inthroot

Integer N-th Root


Description

Determine the integer n-th root of .

Usage

iNthroot(p, n)

Arguments

p

any positive number.

n

a natural number.

Details

Calculates the highest natural number below the n-th root of p in a more integer based way than simply floor(p^{1/n}).

Value

An integer.

Examples

iNthroot(0.5, 6)    # 0
iNthroot(1, 6)      # 1
iNthroot(5^6, 6)    # 5
iNthroot(5^6-1, 6)  # 4
## Not run: 
# Define a function that tests whether 
isNthpower <- function(p, n) {
    q <- iNthroot(p, n)
    if (q^n == p) { return(TRUE)
    } else { return(FALSE) }
  }
  
## End(Not run)

numbers

Number-Theoretic Functions

v0.8-1
GPL (>= 3)
Authors
Hans Werner Borchers
Initial release
2021-04-11

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.