# $N_{max}$ balls in 3 weightings

This is a small generalization of well known 12 balls puzzle:

You are given two-sided scale and some number of balls. All balls have the same weight but one. It is of a different weight, although you don't know whether it's lighter or heavier. You are allowed to do only 3 weighings to determine not only what the different ball is, but also whether it's lighter or heavier. You can distinguish balls, but you do not know a weight of some of them. How many balls with unknown weight you may have and still be able to find the different one?

This answer is a follow up of Joe Z.'s answer on the similar puzzle. If you have problems with understanding this one, you can read Joe Z.'s answer, which explains used notations in much more details, which I would like to skip here.

In the assumption of fixed weighing schedule the optimum (maximum) number of unknown balls are, so to say, 13.5, where optimum (minimum) number of known balls is 1.
The following is solution for tasks with 13 balls with unknown weight (they can be normal, light, heavy), 1 ball with partially unknown weight (it can be either normal or lighter, but it can't be heavier) and 1 ball, which is known to be normal.

It is easy to prove that you can't add more unknown balls and you need at least one known ball.
Indeed:
1. this has $13\times2+1 = 27$ possibilities to choose between, this is maximum having 3 weights and 3 states of them: $27=3^3$;
2. you must use all $27=3^3$ possible sets of ball placement: 2 sets per first 13 balls to distinguish between heavy and light and 1 set (which is "always off the scale") for 14-th ball, but one can see that in this case exactly 27 balls must be on the scale in total during 3 weightings, that means at least one time there must be odd number of balls, this would lead to fault until we have one more ball is needed with known state.

Ball's arrangement:

Ball  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10-11-12-13
W1    L        L  R     R  L     R  R  L  R     L    R        R  L     L  R     L  L  R  L
W2       L     R     L  R     L  R  L  R  R     L       R     L     R  L     R  L  R  L  L
W3          R     L  R     L  L  L  R  R  R     L          L     R  L     R  R  R  L  L  L


Table of inverses here should not include 14th and 15th balls, since they are already different and you can distinguish between them using their properties.

Weighing schedule of balls:

Weighing 1:  1  4  8 12 13 /  5  7 10 11 15
Weighing 2:  2  6  9 11 13 /  4  7 10 12 15
Weighing 3:  5  8  9 10 13 /  3  6 11 12 15


The outcomes interpretation:

= = L :  3L    L = = :  1H   R = = :  1L
= = R :  3H    L = L :  8H   R = L :  5H
= L = :  2H    L = R :  5L   R = R :  8L
= L L :  9H    L L = :  7L   R L = :  4L
= L R :  6H    L L R : 10L   R L L : 12L
= R = :  2L    L R = :  4H   R L R : 11H
= R L :  6L    L R L : 11L   R R = :  7H
= R R :  9L    L R R : 12H   R R L : 10H
= = = : 14L    L L L : 13L   R R R : 13H