Problem 55330. Convert Periodic Continued Fraction to Fractional Radical Representation
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
Tim
on 1 Sep 2022
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).
David Hill
on 1 Sep 2022
Thanks, that was not my intent. I corrected the test suite.
Solution Comments
Show commentsProblem Recent Solvers1
Suggested Problems
-
Find the longest sequence of 1's in a binary sequence.
6345 Solvers
-
19143 Solvers
-
Project Euler: Problem 1, Multiples of 3 and 5
3368 Solvers
-
Rotate input square matrix 90 degrees CCW without rot90
629 Solvers
-
60 Solvers
More from this Author56
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!