OFFSET
0,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..5000
MATHEMATICA
ContinuedFraction[Surd[2, 7], 100] (* Harvey P. Dale, Aug 11 2017 *)
PROG
(Haskell) import Ratio
floorRoot :: Integer -> Integer -> Integer
floorRoot k n | k>=1 && n>=1 = h n where h x = let y=((k-1)*x+n`div`x^(k-1))`div`k in if y<x then h y else x
intFrac :: Rational -> (Integer, Rational)
intFrac x = let ((a, b), ~(q, r)) = ((numerator x, denominator x), divMod a b) in (q, r%b)
cf :: Rational -> Rational -> [Integer]
cf x y = let ((xi, xf), (yi, yf)) = (intFrac x, intFrac y) in if xi==yi then xi : cf (recip xf) (recip yf) else []
y = 2^512 -- increase to get more terms, decrease to get a quick answer
(k, n) = (7, 2) -- compute continued fraction for k-th root of n
main = print (let x = floorRoot k (n*y^k) in cf (x%y) ((x+1)%y))
CROSSREFS
KEYWORD
cofr,nonn
AUTHOR
Paul Stoeber (pstoeber(AT)uni-potsdam.de), Sep 09 2005
STATUS
approved