Advertisement

(Probably) An Easy Question

Started by October 10, 2002 02:41 PM
5 comments, last by Feblex 22 years, 4 months ago
I''m pretty sure a function or something exists somewhere for this, but I need a way to divide a number by 3, and retrieve three whole numbers (they should be different) as the answer. Any input on this would be of great help.
Can you give an example of input/output pair for that function?
What would be the answer for, say, 7?
Advertisement
Thanks for replying...

Anyways, say I had 7, the output would be something like 2,4, and 1.

Or if I had 23, the output could be 10,9, and 4.

I know this is probably impossible, because so many numbers have more than one set of 3 numbers which add up to the number, but I don''t care how it derives it.
I doubt this will work, but, try this:

You have a number N

Subtract the minimum amount from the number to make it evenly divisible by 2. (At least one must be subtracted)

That is one number.

Now divide it by two, add one to one number, and subtract one from the other number.

Let us say the number was 108

108 - 2, one number is 2.
106 / 2, is 53, one number is 54, another is 52

There you have it, 54, 52, 2.

This won''t work for small numbers though, and it may not have even answered the question at all.

En taro Adun!
Doom to all who threaten the homeworld!
*Protoss Zealot - Starcraft*
----------------------------------------------------------You know, I might as well go ahead and say I can't fix the problem... because that's when I figure out how.
How about ¿1, 2 and n-3?
n = base number
x = Any random # from 1 to (n - 2)
y = Any random # from 1 to (n - x - 1)
z = n - (x + y)

n = x + y + z

this assumes that x ,y or z can''t equal less than 1 and that the
number is 3 or greater.

This what you want?

-Hyatus
"da da da"
Advertisement
Thanks alot! These sound like good solutions.

This topic is closed to new replies.

Advertisement