+0

# Beanbag Modular Arithmetic Help

0
88
7

You have 2021 beanbags and 7 boxes numbered 1 through 7. You place your first beanbag in box 1, your second in box 2, all the way to 7th in box 7. Then, you start going backwards; placing your 8th beanbag in box 6, 9th beanbag in box 5, etc. all the way until you put your 13th beanbag in box 1. Your 14th beanbag will be in box 2. This process is iterated until all beanbags are put into boxes. What box will the 2021st beanbag be in?

Thanks in advance for the help!

Apr 20, 2021

#1
+33620
+2

First pass place 7 bags    each subsequent pass places 6 bags

2021 - 7 = 2014

2014 / 6 = 2014/6 = 335 passes   then   4  bags are left over

First pass goes from 7 to 1  ( this is the first pass of '6' after the initial 7)

335th pass goes from 7 to 1

then 4 more bags   go to boxes     2 3 4 5         I think.

Apr 20, 2021
edited by ElectricPavlov  Apr 20, 2021
#2
0

Sorry I think you misunderstood the problem statement. Thank you for your answer though!

Notice that it doesn't go from 7 to 1, it actually goes back and forth. Once you put a beanbag in box 7, then next beanbag you put will be in box 6, and then box 5, and so on. Once you reach box 1 again, you go to box 2, and so on. It keeps looping...

Apr 20, 2021
#3
+33620
0

That is what I posted    it goes   1 - 7     then  backwards to 1    then forwards to 7      then the 2021st bag winds up in box 5   ( by my calcs)

ElectricPavlov  Apr 20, 2021
#4
0

Guest Apr 20, 2021
#5
+121003
+1

Note  that   we  will  have  the following

As  EP  said   ....after  the  first pass  each subsequent pass  places  6  bags

So

[2021 - 7]  /  6  =   335 additional  passes   after  the  first pass  plus  4 additional bags

Let   the  first pass =  pass 0

And  notice  that  after  5 more passes we  end up  in  box 1

pass                0                  1                  2                   3                   4                   5

1 2 3 4 5 6 7  / 6 5 4 3 2 1  / 2 3 4 5 6 7 / 6 5 4 3 2 1  /  2 3 4 5 6 7  /  6 5 4 3 2 1 /

We  have   335  additional passes  after  the  first  pass....so   there will  be  335/5  =   67  "red" cycles  with  30  boxes  in each cycle

And at the start of the  68th  cycle  we will  place   4  more  bags  in boxes  2 3  4  5

So...we end up in box  5.....just as EP  found

Proof

7  +  30*67  + 4    =  2021   boxes filled

Apr 20, 2021
edited by CPhill  Apr 20, 2021
#6
0

Thanks so much for your response! I understand the problem now :)

Apr 20, 2021
#7
+121003
0

No prob  !!!

CPhill  Apr 20, 2021