Every periodic continued fraction can be prepresented by a number of the form
where p, q, and d are all integers with d>0,
, and d not a perfect square. Given the cointued fraction sequence, both the beginning sequence and cyclic part of the sequence [front, cyclic], output the unique p, q, and d (in reduced form). p and q can both be negative.
Solution Stats
Problem Comments
2 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers1
Suggested Problems
-
Remove all the words that end with "ain"
2670 Solvers
-
Extract leading non-zero digit
2249 Solvers
-
96 Solvers
-
Divisible by n, prime vs. composite divisors
114 Solvers
-
Divisible by n, Composite Divisors
77 Solvers
More from this Author63
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Tests 8 and 9 have Z(1) three times instead of, presumably, Z(1), Z(2), and Z(3) (not that it's going to help me any).
Thanks, that was not my intent. I corrected the test suite.