- #1
SpunkyDonutz
- 29
- 0
I've been trying to figure this out for a couple of hours and I just don't know how to work it out, I have attempted to create a valid statement for the algorithm, but I just don't know what I'm doing.
I would be greatly appreciative for any help I could get on this.
Thanks!
Twenty-five large empty boxes are placed on a table. An unknown
number of the boxes is selected and, into each, seven medium boxes are placed. An
unknown number of the medium boxes is selected and, into each, seven small boxes
are placed.
At the end of this process there are 291 boxes in total. How many empty boxes
are there? You should use the following steps in order to solve the problem.
1. Introduce the variables e and t for the number of empty and the number of
total boxes, respectively.
2. Identify the information that is given about the initial and final values of e and
t.
3. Model the process of putting seven boxes inside a box as an assignment to e
and t.
4. Calculate an invariant of the assignment.
5. Combine the previous steps to deduce the final value of e .
Initial:
e = 25
t = 291
Final:
e = ?
t = 291
(e-t)[e, t := e+7, t-1]
=
(e+7) – (t-1)
=
e-t-5
I would be greatly appreciative for any help I could get on this.
Thanks!
Homework Statement
Twenty-five large empty boxes are placed on a table. An unknown
number of the boxes is selected and, into each, seven medium boxes are placed. An
unknown number of the medium boxes is selected and, into each, seven small boxes
are placed.
At the end of this process there are 291 boxes in total. How many empty boxes
are there? You should use the following steps in order to solve the problem.
1. Introduce the variables e and t for the number of empty and the number of
total boxes, respectively.
2. Identify the information that is given about the initial and final values of e and
t.
3. Model the process of putting seven boxes inside a box as an assignment to e
and t.
4. Calculate an invariant of the assignment.
5. Combine the previous steps to deduce the final value of e .
Homework Equations
The Attempt at a Solution
Initial:
e = 25
t = 291
Final:
e = ?
t = 291
(e-t)[e, t := e+7, t-1]
=
(e+7) – (t-1)
=
e-t-5
Last edited: