For each weighing, there are three outcomes: l>r, l=r, l<r. From N weighings, we get 3^N outcomes. We exclude the outcome of all weighings being equal because it's impossible to achieve if at least one coin has a different weight to the others and every coin gets weighed at least once. This leaves us with (3^N)-1 outcomes from N weighings.
For X coins, only one coin will be different, and it will only be different in one of two ways. This means that there are X*2 possible sets of coins.
Thus, the most coins we can analyse given N weighings is when X*2=(3^N)-1, or X=((3^N)-1)/2
For two weighings, we can do four coins. For three, thirteen. For four, forty. For five, one hundred and twenty-one.
These results are only possible if an extra coin that's known to have the correct weight is also available. For example, finding thirteen coins in three weighings requires you to weigh five coins against four for each weighing. Adding a known correct coin to the side which would normally only have four coins makes that sort of weighing possible.