Help with the solution of the problem.
What should the algorithm look like? Expand the fraction p / q into the sum of fractions of the form 1 / n. For example, 3/7 = 1/3 + 1/11 + 1/231. Everything is solved through a cycle, only what selection parameters should be?
If anyone is not difficult, help. Thank you in advance. C language.
- oneOf course, I am not a mathematician, but isn't 3/7 the same as (1/7 + 1/7 + 1/7)? - alvoro
- Unfortunately, as it turns out, no. This Egyptian fractions like. The question is, what's with the algorithm? - OverLoader
- @OverLoader, so you would write that fractions should be different. IMHO, the algorithm decomposition is better to ask in mathematics , and with the problems with the implementation already here. - alvoro
- Well, since you know the name, a quick look at Wikipedia on the Egyptian fractions and the Fibonacci algorithm was found, and even described in detail. We take the formula, in the cycle until the second term acquires a unit in the numerator and is ready. - Alex Krass
|