kekke2000
Premium
- 1,936
- Sweden
- kekke2000
I'm seeking a formula for this problem. I dont even know if it's possible.
If you have a bucket of potatoes (X). You can take a potato and cut it into 4 pieces(Y). Everytime you cut a potato you get X-1 and Y+4. Now to the fun part.
I want to know how many potatoes (X) you need to have left to have twice as many pieces(Y) than potatoes.
Example: If you have 5 potatoes and 4 pieces you only need to cut one potato to get twice as much pieces (8) as you have potatoes (4). So the answer is 4 because you will have 4 potatoes left.
X=5
Y=4
will result in Z=4
X=7
Y=8
will result in Z=6
If you can just find out how many cuts needed you can take X-(insert formula here). Please help me with this wonder!
For programmers.
I can achieve a pretty good answer from a simple VB-code, but I want a formula.
If you have a bucket of potatoes (X). You can take a potato and cut it into 4 pieces(Y). Everytime you cut a potato you get X-1 and Y+4. Now to the fun part.
I want to know how many potatoes (X) you need to have left to have twice as many pieces(Y) than potatoes.
Example: If you have 5 potatoes and 4 pieces you only need to cut one potato to get twice as much pieces (8) as you have potatoes (4). So the answer is 4 because you will have 4 potatoes left.
X=5
Y=4
will result in Z=4
X=7
Y=8
will result in Z=6
If you can just find out how many cuts needed you can take X-(insert formula here). Please help me with this wonder!
For programmers.
I can achieve a pretty good answer from a simple VB-code, but I want a formula.
Code:
111
If X * 2 > Y Then
X = X - 1
Y = Y + 4
GoTo 111
End If
Z=X
Last edited: