King Bob has tons of gold and silver, and he wishes to introduce a new currency to his kingdom. He orders a custom coin printing machine to be built for producing the gold and silver coins. He wishes each citizen to have an opportunity to print themselves some coins, as he is a strong believer in empowering of ordinary people. The new currency is his number one development target and he decides to personally oversee the implementation of the initiative.
Full of enthusiasm, his newly hired development team starts to work on the coin printer. They start by building a machine prototype that prints 1 oz t silver coins. King Bob seems happy with the initial prototype. The team proceeds to printing of gold coins. Due to gold having greater density, the team ends up with a prototype gold coin that has the same volume as the prototype silver coin but weighs more. Bob does not approve. He wishes all of his coins to have the same weight rather than the same volume. The development team attempts to fix the problem by creating a special mold that splits the gold into a 1 oz t coin and a separate token containing all the extra gold. Bob approves the workaround as he wishes to rush his new currency into production. As a final improvement request King Bob asks for the "print a coin" button on the machine to randomly print a gold or a silver coin with equal probability. The development team hesitates at first -- "Does true random even exist?" However, by some miracle, they manage to make it work.
The coin printing machine seems to now be working as expected, as long as we ignore the extra gold tokens that get produced as a side effect of printing the actual coins. King Bob orders all prototype tokens and coins to be melted and recycled as material for printing new coins. He orders the members of the development team to take turns in ensuring flawless operation of the coin printer.
With the required machinery in place, Bob now needs to come up with a policy for distributing the coins. He wishes each one of his citizens to have a gold coin but he also wishes to get some silver coins into circulation. He comes up with the following. Each adult citizen, aged 20 or above, is to approach the printer one at a time. The citizen has to press the button to produce a coin. Each silver/gold coin produced will become property of the citizen who pressed the button. Whenever, a silver coin gets produced the citizen is required to press the button again. Once a gold coin is produced, the citizen is to stop pressing the button. The gold tokens will be collected for state treasury, so no gold tokens will go into circulation.
After a while, King Bob, gets a report that the entire adult population of the kingdom has gone through this process. He orders the money printer operators to keep applying the process to new citizens who reach adulthood. One day, however, king Bob orders coin printing to freeze temporarily. He wishes to know how many of his gold and silver coins are already in circulation. Unfortunately, bookkeeping was never part of the process. However, the state treasury still has all the gold tokens that got produced as a side effect of producing the coins. Your job is to estimate the amount of gold and silver coins based on the amount of tokens.