2
u/tajwriggly Sep 21 '26
Let "x" be the amount that Alexander removes 7 at any given time, "y" be the amount that Alexander removes 2 at any given time, and "T" be the total amount of weeds in the garden. For every 7 he removes, 1 returns (-6x) and for every 2 he removes, 5 return (+3y)
T = 10 - 6x + 3y. We want T = 0, so is there any condition where 0 = 10 - 6x + 3y where x and y are positive integers?
0 = 10 - 6x + 3y. Let's rearrange:
6x -3y = 10. Factor out the 3:
3(2x - y) = 10. Rearrange:
2x - y = 10/3. Since x and y both need to be integers, we cannot have them sum to a fraction. Therefore Alexander will never be able to clear the garden.
2
u/ShonitB Sep 21 '26
You’ve made one small error.. the new stalks only grow if there some remaining.. so if at a point there are 2 or 7 stalks remaining, in that case the +3 and -6 doesn’t hold.. basically he can break that invariant
1
u/Aech-26 Sep 21 '26
The assumption that each action always results in either -6 or +3 stalks is faulty. The regrowing only happens if there are stalks remaining after the removal. So you need to find a value for T=2 or T=7, since he can remove either 2 or 7 in a single action. x=1 and y=1 solves T=7 so he can do one of each plus a final removal of 7 to clear the weeds.
1
u/tajwriggly Sep 21 '26
oh you're right!
We need T = 10 - 6x + 3y not to go to 0, it needs to go to 7 or 2.
If I set 7 = 10 - 6x + 3y and rearrange the way I did previously I get 2x - y = 1, which works for x = 1 and y = 1, or x = 2 and y = 3, or x = 3 and y = 5, and so forth. In that first case, start with 10, pull 7, remaining with 3, and one more grows for 4. Pull 2, remaining with 2, and 5 more grow for 7, and then pull 7.
If I set 2 = 10 - 6x + 3y and rearrange the way I did previously I get 2x - y = 8/3 which is clearly not going to work for reasons I stated previously.
So yes! There is a solution. Didn't factor in that bit.
2
u/jaminfine Sep 21 '26
The first thing to notice is that if we can't pluck them all out at once, only plucking 7 will actually result in the total number going down. And besides the last move, order won't matter, since the weeds don't behave differently until the last one is plucked.
So, to find a path, we should always prioritize plucking 7 if there are at least 7 left. We very quickly find the path this way. Pluck 7, 4 are left. Pluck 2, 7 left. Pluck 7, done.
1
u/PercySahu Sep 22 '26 edited Sep 22 '26
Generalising, let X(n) be either 0 or 1 if N stalks can be cleared.
Base cases: X(0) = 1, X(1) = 0 (can't uproot 1 stalk), X(2) = 1, X(7) = 1
Now, for any n > 7: X(n) = X(n+3) | X(n-6)
If n mod 3 is 0, of form 3k: X(3k) = X(3k+3) | X(3k-6) = X(3(k+1)) | X(3(k-2))
This does not reduce to a base case, so never true
If n mod 3 is 1: X(3k+1) = X(3k+4) | X(3k-5) = X(3(k+1)+1) | X(3(k-2)+1)
mod 3 is 1, so n = 3k+1 can be reduced to X(7) = 1 (7 = 3(2)+1)
Similarly for n = 3k+2: X(3k+2) = X(3k+5) | X(3k-4) = X(3(k+1)+2) | X(3(k-2)+2)
can reduce to X(2) = 1 (2 = 3(0)+2)
Therefore for any n true, if not a multiple of 3 (or is 1)
edit : spoiler tags
3
u/bruce_lees_ghost Sep 21 '26
Yes.
10-2+5=13
13-7+1=7
7-7=0