I know we haven't been doing much of these C++ Community problems so I though I'd write one up to get it started once again.

Problem Statement: For some integer `v,w,x,y,z` find all solution to the following equation

``````   1   1   1   1   1
- + - + - + - + - = 1
v   w   x   y   z
``````

For example one solution is `v = w = x = y = z = 5`, find the rest. If there are none the prove it with your code or some algebra. Happy coding fellas.

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by firstPerson

There's nothing specifying that the numbers have to be positive. In that case, there are an infinite number of solutions, or since we're talking computer, "billyuns and billyuns" of them as our favorite astronomer used to say. v = w = x = 3. y and z and arithmetic inverses of each other (1, -1), (2, -2), (3, -3), etc so their reciprocals add to zero and they drop out. That's four billion right there. There are 5 choose 2 = 10 ways of picking which pair of variables are arithmetic inverses, so make it 40 billion and I'm just getting warmed up. Shall we change the problem to requiring the integers to all be positive?

I guess we also have to specify that the formula is not computed with integer arithmetic. Otherwise, for any integer greater than 1, the division would yield 0, and thus, there would be "billyuns and billyuns" of possibilities too (`2^160` for 32bit unsigned integers). ;)

Omg nitpickers haha. Sorry should have been more precice.

• For all positive number `v,w,x,y,z`
• 1/a is not an integer division
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.