There are $n$ coins, $3k$ of which are real (with equal positive weight) for some $k\geq 1$ and the rest fake (with zero weight), but you don't know $k$. You have a scale that, between two sets of coins, tells you which set is heavier (or if they are equal). What is the worst-case minimum number of weighings that you must use in order to divide the coins into three sets so that each set contains $k$ real coins?
Using binary search you can divide the coins into two sets with $3k/2$ real coins each using $\log n$ weighings. From here you can divide the coins into four sets with $3k/4$ real coins each using $2\log n$ more weighings, and so on. However, this doesn't allow you to get a set with $k$ real coins.
Partition the coins into three roughly equal subsets $A,B,C$. Use two weighings to determine the lightest of these, wlog. this is $A$. Use binary search (i.e., $\sim \log\frac n3$ weighings) to find $B'\subseteq B$ of equal weight as $A$. Similarly, find $C'\subseteq C$ of equal weight as $A$. Set $A,B',C'$ aside as three subsets having the same number $l\le k$ of real coins. Now we have reduced the problem to $n'\le n-\lfloor \frac n3\rfloor=\lceil\frac23n\rceil$ and $k'=k-l$ (which may but be $=0$). Repeat this.
Note that $n'<n$ if $n>3$. And as soon as $n\le 3$, we can stop: Either $k=1$ and $n=3$ and each coin is real and we have a straightforward solution; or $k=0$ and any partition will do.
The master theorem applied to $T(n)= T(\frac23n)+\log n $ gives us that the number of weighings this specific (possible non-optimal) method uses is $$O(\log^2n).$$
Remark: The expected performance of the above method may be much better: As long as $n$ and $k$ are large, a random subset of size $\frac n3$ should contain about $k\pm\sqrt k$ real coins, so we may expect $k-\sqrt k$ real coins in the lightest set, which leads roughly to $k'\approx \sqrt k$ and $n'\approx\frac n{\sqrt k}$.