|Bill Allombert on Mon, 04 Feb 2008 15:45:18 +0100|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|Re: integer n-roots like sqrtint()|
On Mon, Feb 04, 2008 at 12:20:27PM +0100, Jeroen Demeyer wrote: > Hello list, > > I am wondering if there is an analogous function to sqrtint, but for > n-th roots? With this I mean to compute floor(sqrtn(x,n)) exactly for > integers x and n. > Unfortunately the obvious "floor(sqrtn(x,n))" does not work: > > gp> \p100 > realprecision = 105 significant digits (100 digits displayed) > gp> floor(sqrtn(6^3,3)) > %33 = 5 Using round would be significantly more reliable... If x is a perfect n-power, you can use ispower(x,n,&z);z Cheers, Bill.