Let me explain my numbers:

If there are 13 bags, and one of them is magic, then, we can put n beans from the nth bag from the first 12 bags, this gives us total of 78. Whatever over weight will tell us the magic bag. If the weigh is exactly 78, then we know the 13th bag is the magic.

Now that we know we can handle 13 bags, in the next to the last weigh, we can have 13 1s, 13 2s, 13 3s and 4 4s, if the magic bag is among them, this weigh will restrict it to 13 bags.

Now that we know we can handle 43 bags with two weighs, in the third to the last weigh, we can have 43 1s, and 27 2s (total of 97 beans).

The rest of them is easy, 99 beans each round.