Alternator Coins
Benjamin Chen, Ezra Erives, Leon Fan, Michael Gerovitch, Jonathan Hsu, Tanya Khovanova, Neil Malur, Ashwin Padaki, Nastia Polina, Will Sun, Jacob Tan, Andrew The
aa r X i v : . [ m a t h . C O ] M a y Alternator Coins
Benjamin Chen, Ezra Erives, Leon Fan,Michael Gerovitch, Jonathan Hsu, Tanya Khovanova,Neil Malur, Ashwin Padaki, Nastia Polina,Will Sun, Jacob Tan, Andrew The
Abstract
We introduce a new type of coin: the alternator . The alternator canpretend to be either a real or a fake coin (which is lighter than a real one).Each time it is put on a balance scale it switches between pretending tobe either a real coin or a fake one.In this paper, we solve the following problem: You are given N coinsthat look identical, but one of them is the alternator. All real coinsweigh the same. You have a balance scale which you can use to find thealternator. What is the smallest number of weighings that guaranteesthat you will find the alternator? Mathematicians have been fascinated with coin puzzles for a long time. Thesimplest coin puzzle is formulated like this:You are given N coins that look identical, but one of them is fakeand is lighter than the other coins. All real coins weigh the same.You have a balance scale that you can use to find the fake coin.What is the smallest number of weighings that guarantees findingthe fake coin?The above puzzle first appeared in 1945. Since then there have been manygeneralizations of this puzzle [3]. A new generalization that inspired this paperappeared in 2015 [4]. This generalization introduces a new type of coin, calleda chameleon coin , which can mimic a fake coin or a real coin. The chameleoncoin has a mind of its own and can choose how to behave at any weighing. Itis impossible to find chameleon coins among real coins as the chameleons canpretend to be real all the time. An interesting question to ask is: given thata mix of N identical coins contains one chameleon and one fake coin, find twocoins one of which is guaranteed to be a fake [4].We can draw a parallel between coin puzzles and logic puzzles. Real coins aresimilar to truth-tellers, and fake coins are similar to liars. Many logic puzzlesinclude normal people: people who sometimes tell the truth and sometimes1ie. Thus a chameleon coin is an analogue of a normal person. In additionto normal people, some logic puzzles have alternators : people who alternatebetween telling the truth and lying. In logic puzzles if you are talking to onenormal person s/he can behave consistently as a truth-teller or a liar, and it isimpossible to find out who this person is. It is different with the alternatingperson. To identify them, you can just ask them how much is two plus two—twice.Coming back to coins. As chameleon coins are analogues of normal people inlogic puzzles, it would be natural to introduce the analogues of the alternatorsto coin puzzles. It would be logical to call such a coin the alternator . Thealternator can mimic a fake coin or a real coin. But there is a deterministicrule. The alternator switches the behavior each time it is on the scale. Unlikethe chameleon, the alternator coin can always be found.In this paper we solve the question of finding one alternator among N coinsusing the balance scale in the minimum number of weighings. In Section 2 wepose the problem, provide notation, small examples, and trivial bounds. InSection 3 we provide an information-theoretic argument for a stronger lowerbound. In Section 4 we produce a strategy that matches the lower bound, thussolving the problem.This project was researched at the PRIMES STEP program, which is ayounger branch of the MIT PRIMES program. The goal of the PRIMES pro-gram is to help gifted high-schoolers conduct research in mathematics. ThePRIMES program started in 2011 and has been extremely successful [2]. In2015 the PRIMES staff decided to start a new program, PRIMES STEP, formiddle schoolers. The goal is to train gifted students in middle school for mathcompetitions, to teach them to think mathematically, and to do research withthem. In the fall of 2015, the students worked on a logic project, and togetherwith their mentor Tanya Khovanova wrote a paper, Who is Guilty? [1].The Alternator Coin project was conducted at PRIMES STEP in the springof 2016. The leader of the project was Tanya Khovanova. Her co-authors werein seventh or eighth grade at that time.
We are given N identically looking coins. All but one coin are real and weighthe same. One coin is special and is called the alternator coin . It alternativelymimics a real coin and a fake coin. That means, when the alternator is put on abalance scale it either weights the same as a real coin or is lighter. The alternatoris similar to the chameleon coin first defined in [4]. The chameleon coin canchoose randomly and independently how to behave. Unlike the chameleon coin,the alternator is more deterministic. It switches its behavior each time it is puton the scale. As usual in coin puzzles, we have a balance scale and we needto find the alternator. More precisely, we need to find the smallest number ofweighings that guarantees finding the alternator coin.We denote the smallest number of weighings as a ( N ).2n addition to a ( N ) we study two more sequences. We can simplify ourproblem by assuming that the status of the alternator coin is known in advance.We call it the deterministic alternator . Sequence f ( N ) is the smallest numberof weighings that guarantees to find the alternator among N coins if the alter-nator starts as fake. Sequence r ( N ) is the smallest number of weighings thatguarantees to find the alternator among N coins if the alternator starts as real.We also want to introduce the state of the alternator. We say that thealternator is in f -state if the next time it will be on the scale it will behaveas a fake coin. We say that the alternator is in r -state if the next time it willbe on the scale it will behave as a real coin. That is to say, for calculating f ( N ), correspondingly r ( N ), we assume that the alternator starts in the f ,correspondingly r , state. For calculating a ( N ) we do not know the startingstate of the alternator. We call it the a -state.Note that after the alternator is found, even if it starts in the a -state, we cancalculate its state during each weighing retroactively. There is one exception. Itis possible to deduce that the alternator is the coin that was never on the scale.In this case, if the alternator starts in the a -state, we would still not know itsstate, when we find it. Here we remind the readers the standard solution to the puzzle with one fakecoin. We will use similar ideas with the alternator coin later.Suppose there is a strategy that finds a fake coin in w weighings. Supposecoin number i is fake. Then there is a sequence of weighings after which wedetermine that the i -th coin is indeed the fake coin. The output of each weighingis one of three types: • E—when the pans are equal weights. • L—when the left pan is lighter. • R—when the right pan is lighter.We can represent the sequence of weighings that results in our conclusionthat the i -th coin is fake as a string of three letters: E, L, and R. Obviously,the same string cannot correspond to two different coins. That means that thenumber of coins that can be processed in w weighings is not more than 3 w .On the other hand, it is easy to produce a strategy that finds the fake coinout of N coins in ⌈ log N ⌉ weighings. For example, if the number of coins is3 w , we can divide all the coins into three parts with 3 w − coins in each. Weput two parts on the scale and if the scale unbalances, then the fake coin is onthe lighter pan. If the scale balances, then the fake coin is in the pile that wasnot on the scale. This way with each weighing we make the pile containing thefake coin three times smaller. Using this algorithm we can find the fake coin in w weighings. If the total number of coins is not a power of three, the same ideaworks. We will leave the details to the reader.3 .2 Trivial bounds The alternator is trickier than just a regular fake coin, so we expect to use moreweighings. Also the a state provides us less information then the f and r states.That means, a ( N ) ≥ r ( N ) and a ( N ) ≥ f ( N ). In the following lemma, thesolution for one fake coin allows us to set trivial lower and upper bounds for thealternator coin. Lemma 1.
If the total number N of coins is in the range: k − < N ≤ k ,then the bounds for the a and r starting states are: k + 1 ≤ a ( N ) , r ( N ) ≤ k. The bounds for the f starting state are: k ≤ f ( N ) ≤ k − . Proof.
We proceed with the lower bound. The same information-theoretic ar-gument as we presented above works for the f -state. In addition to that, if thealternator starts in the r -state, then the first weighing will balance. It will notprovide any information for any coin; it will just change the state of the coinsthat are on the scale. As the a -state is not better than the r -state, the samelower bound works for the a -state too.The upper bound is due to the following strategy. Do the same thing asif looking for the fake coin, but perform every weighing twice. If the alterna-tor participates in two weighings in a row, it has to act as fake in one of theweighings. This way after two weighings we will know which of the three pilescontains the alternator. If the alternator starts in the f -state, then we do notneed to repeat the first weighing twice.For example, this means that r (2) = r (3) = a (2) = a (3) = 2 and f (2) = f (3) = 1. Also, if 4 ≤ N ≤
9, then a ( N ) and r ( N ) are 3 or 4. For a small number of coins we searched all possible strategies. We present theweighing strategies in a way that will be useful for our induction later. Thefollowing properties of our strategies are important to notice: • We present the strategies for the a case. • The same strategy works for the r case if we ignore the branch when thefirst weighing unbalances. • The same strategy without the first weighing works for the f case. • The strategy for 2 k + 1 coins is generated from the strategy for 2 k coins:one coin is put aside from the start and if all the weighings balance, thealternator is that put-aside coin. 4 .3.1 Two or three coins There is only one possible type of weighing we can do: compare one coin toanother coin on the scale. We can find the alternator coin in two weighingsby comparing the first and the second coin twice. If one of these coins is thealternator, it will reveal itself. If not, which can only happen if the total numberof coins is three not two, then after both weighings balance, we know that thealternator is coin number 3.We see that f (2) = f (3) = 1 and r (2) = r (3) = a (2) = a (3) = 2. The trivial bound shows that we need at least 3 weighings for the a and r caseand at least two weighings for the f case. Here we show how to resolve the a case in three weighings. The numbers are the indices of the coins.Compare coins 1, 2 versus 3, 4. If the weighing is unbalanced, then thelighter pan contains the alternator. After that we can find the alternator in twoweighings. If the weighing is balanced, then the second weighing is comparing 1to 2, and the third weighing is comparing 3 to 4. At this time, if the alternatoris among the first four coins, it will reveal itself. If all the weighings balance,then coin 5 is the alternator.Therefore, a (4) = r (4) = a (5) = r (5) = 3 and f (4) = f (5) = 2. We presented the strategies that will be a part in our induction process. It ispossible to have completely different strategies. Here is a different strategy forfinding the alternator in three weighings when N = 4.Compare 1 to 2 in the first weighing. Compare 2 to 3 in the second weighing.Compare 1 to 3 in the third weighing. If at any point one of the weighings isunbalanced, then the lighter pan contains the alternator. If all the weighingsbalance, we see that every coin participated in two weighings each. This meansthat all these coins are real and the fourth coin is the alternator.As you might notice for the examples we have a ( N ) = r ( N ) = f ( N ) + 1. Isthis always true? To maintain the suspense, let us hold back the answer to thisquestion. To present and prove our new and better bound we first need to introduce theJacobsthal numbers.
The Jacobsthal numbers J n are defined as J n = (2 n − ( − n ) /
3. This is se-quence A001045 in the OEIS [5]. The Jacobsthal numbers satisfy the following5ecursion: J n +1 = J n + 2 J n − . Indeed, the two geometric series 2 n and ( − n satisfy this recursion, together with any linear combination of them.The Jacobsthal numbers are the coolest numbers you never heard about.The OEIS page has a lot of different definitions for the Jacobsthal numbers.For example, J n is the number of ways to tile a 3-by-( n −
1) rectangle with1-by-1 and 2-by-2 square tiles. Also J n is the number of ways to tile a 2-by-( n −
1) rectangle with 1-by-2 dominoes and 2-by-2 squares. We leave it to thereader to prove these properties.Another property that we also leave to the reader: the product of two suc-cessive Jacobsthal numbers is always a triangular number.But we digress. We do not need these cool properties for our future progress.What we need is the following lemma which is also easy to prove:
Lemma 2. J n = 2 J n − − ( − n . We actually do not need this lemma but rather its consequence.
Corollary 3.
If a number k is between two successive Jacobsthal numbers: J n < k ≤ J n +1 , then k = 2 J n − + m , where ≤ m ≤ J n . The Jacobsthal numbers are very important in this paper. We will see thateach of our three sequences increase by 1 right after every N that is a Jacobsthalnumber. We use information theory again to produce a better bound.
Theorem 4.
The number of coins we can process in w weighings is not morethan J w +2 if the alternator is in f -state. In r - or a -state the number of coinswe can process in w weighings is not more than J w +1 .Proof. Suppose there is a strategy. Let us assign a string in the alphabet ELRto each coin. If coin i is the alternator, the string corresponds to the strategythat finds this coin. Strings assigned to different coins must be different. Thelength of the string is not more than the number of weighings. The new andimportant observation here is the following: letters L and R cannot follow eachother. They must be separated by at least one letter E. Suppose our alternatorcoin is on one of the pans that is lighter. If the alternator does not participatein the next weighing, then the weighing will balance. If it does participate inthe next weighing, the weighing will balance too as the alternator will be in the r -state.Now we need to calculate the maximum number of strings of given length w with this property. Notice that it is theoretically possible to have the stringsof shorter length to point to a coin, that is, some coins might be found fasterthan others. But if a shorter string points to a coin, then all the strings withthe same prefix point to the same coin. Thus to find the theoretical maximumwe should only count strings of fixed length w .6et us calculate the number of such strings by induction. Denote this numberas s ( n ). We have 1 string (an empty one) of length zero and 3 strings of lengthone. The number of strings of length k can be calculated is follows. If the stringstarts with E, then it can be followed by any such string of length k −
1. If itstarts with L or R, it must be followed by E and then any such string of length k −
2. Therefore, we have a recursion: s ( n ) = s ( n −
1) + 2 s ( n − s ( n ) = J n +2 . What remains to note is thatif the alternator is in r -state the first letter of the string must be E.The lower bound for the number of weighings increases after each Jacobsthalnumber. In the next section we will see that the bound is precise. Here we want to produce a strategy that can find the alternator in the samenumber of weighings provided by the bound above. First we deal with an f and r cases and the total of N coins. We define the strategy recursively. Strategy • Suppose the coins are in the f -state. Suppose N is more than J k and notmore than J k +1 . We weigh two piles each containing J k − coins. If thescale unbalances, then the alternator is in one of the piles on the scale andit will switch its state to r . Now we need to process J k − coins in state r .If the scale balances, the alternator is not on the scale, and is still in state f . It is among other coins and did not switch its state. Now we need toprocess N − J k − in state f . • Suppose the coins are in the r -state and N is even. We arrange two pilesof N/ f . Now we need to process N coins in state f . • Suppose the coins are in the r -state and N is odd. We put one coin asideand proceed with an even number, N −
1, of coins as above. At the endof the weighings, if we do not find the alternator, then the put-aside coinis the alternator.Notice that the strategy matches our examples for the total of 2 to 5 coins.In the following theorem we assume that the number of weighings is at least1. We use the strategy above to prove the theorem.
Theorem 5.
For the f -state, the number of coins N we can process in w weighings is J w +1 < N ≤ J w +2 . For the r -state, the number of coins N we canprocess in w weighings is J w < N ≤ J w +1 .Proof. We proceed by induction on k , the index of the Jacobsthal numbers.Assuming the theorem holds for the number of coins up to J k , we will showthat it holds for the number of coins up to J k +1 .7or the base of induction we use the small examples we have already covered.For the f -state, in one weighing we can process N coins, where J = 1 < N ≤ J = 3. In two weighings we can process N coins, where J = 3 < N ≤ J = 5.For the r -state, in one weighing we can process N coins, where J = 1 < N ≤ J = 1; that is, nothing can be done in one weighing. In two weighings wecan process N coins, where J = 1 < N ≤ J = 3. In three weighings we canprocess N coins, where J = 3 < N ≤ J = 3. For the number of coins up to5 = J our theorem holds.Suppose the theorem is true, and we can find a strategy for the number ofcoins up to J k , where k > k − f -state and atleast k − r -state. Consider the number of coins N that ismore than J k and not more than J k +1 . For our induction step we need to findthe strategy for the f -state in k − r -state in k weighings.First consider the f state. By Corollary 3, we have N = 2 J k − + m , where0 ≤ m ≤ J k . Our strategy is to weigh two piles each containing J k − coins andhave m coins left outside the scale. If the scale unbalances, then the alternatoris in one of the piles on the scale. It switches state to r . By our inductionhypothesis r ( J k − ) = k −
2. If the scale balances, then the alternator is in theleftover pile and has state f . By our induction hypothesis f ( m ) ≤ f ( J k ) = k − k − r -state. If N is even, we weigh all the coins switchingtheir state to f . By the induction hypothesis, we just showed how to find thealternator among these coins in k − k weighings total.Suppose N is odd. We put aside one coin and proceed with the rest of thecoins as above. We need to show that we will not end up with a contradiction.That is, if all the weighings balance, the only possibility for the alternator is tobe the coin that is put aside. Note that if one of the weighings is unbalanced,then the coin that we put aside cannot be the alternator.Suppose N is even and all the weighings balance. In the first weighing wehave all the coins on the scale and they turn their state to f . If the secondweighing balances, that means that all the coins on the scale are real, so theydo not participate in any further weighings. The number of leftover coins iseven and they are in state f , so we proceed with them. After each successivebalanced weighing, we remove an even number of coins from consideration andwe are left with an even number of coins. At the end, the number of coinsthat are left must be zero. Indeed, if we are left with more than 1 coin thathasn’t been on the scale for the second time, we cannot differentiate which oneis the alternator. That means the alternator must be on the scale at least twice.Therefore, there is at least one unbalanced weighing.Now let us go back to odd N . If all the weighings balance, the alternatormust be the put-aside coin.We now want to consider the a case, when the state of the alternator is notknown. Here is the strategy: 8 trategy • If N is even we arrange two piles of N/ f . Now we need toprocess N coins in state f , so we follow the strategy above. If the weighingunbalances, the alternator is on the lighter pan, and in state r . We usethe strategy above to process these coins. • If N is odd, we put one coin aside and proceed with the rest of the coinsas above. At the end of the weighings, if we do not find the alternator,then the put-aside coin is the alternator.In the following theorem we assume that the number of weighings is at least1. We use the previous strategy to prove the theorem. Theorem 6.
For the a -state, the number of coins N we can process in w weigh-ings is J w < N ≤ J w +1 .Proof. In the first weighing we weigh all or all but one coin. If the weighingunbalances, then the alternator is one of the ⌊ N/ ⌋ coins on the scale. ByLemma 2, we see that N/ ≤ J w − ( − w +1 /
2. Therefore, ⌊ N/ ⌋ ≤ J w . ByTheorem 5 we can process not more than J w coins in w − w − f state, and we can process them in w − w .By similar reasoning as above, the coin that was put aside is the alternatorif all the weighings balance. Corollary 7. a ( N ) = r ( N ) = f ( N ) + 1 . We would like to thank the PRIMES STEP program for the opportunity to dothis research. In addition, we are grateful to PRIMES STEP Director, Dr. SlavaGerovitch, for his help and support.
References [1] B. Chen, E. Erives, L. Fan, M. Gerovitch, J. Hsu, T. Khovanova, N. Malur,A. Padaki, N. Polina, W. Sun, J. Tan, and A. The, Who Is Guilty?,arXiv:1603.08549 [math.HO] (2016).[2] P. Etingof, S. Gerovitch, and T. Khovanova, Mathematical Research in HighSchool: The PRIMES Experience,
Notices of the AMS , v.62, n.8, pp.910–918(2015). 93] R. K. Guy and R. J. Nowakowski, Coin-Weighing Problems,
Amer. Math.Monthly , v.102, n.2, pp.164–167 (1995).[4] T. Khovanova, K. Knop and O. Polubasov, Chameleon Coins,arXiv:1512.07338 [math.HO], (2015).[5]
The On-Line Encyclopedia of Integer Sequences , published electronically at https://oeis.orghttps://oeis.org