According to the latest E&T magazine, Lego bricks get sorted first in the factory into foil bags before being boxed. This prepacking involves weighing a collection of components, in a bag, to within a few mg. If the total weight is wrong, they may have injected some bricks of the wrong shape…but they can’t tell which without a visual inspection.
Today’s invention is a way to tell, from the total weight of such a collection, the numbers of each type of part present.
Maths tells us that any product of prime numbers is unique to them -ie 2x2x3x7=84 can only be reached by multiplying this particular combination of primes together, no other set of primes will do.
We also know that Ln(2)+Ln(2)+Ln(3)+Ln(7)=Ln(84) and since Ln(x) is monotonic, this means that the only way to get to Ln(84) is by adding together the components on the left hand side. If we manufacture each design of brick so that it weighs a unique, prime number of milligrammes, then we can tell exactly what combination of brick designs are contained in a bag -just by weighing it accurately. This assumes of course that the brick manufacturing is undertaken to very tight tolerances in weight (which is true).
Any significant difference in weight from the expected total and we can then diagnose what the rogue bricks it contains (or which are missing) are.