# The 3 wallets problem

*This post was released for Issue 17 of Bitcoin Magazine as part of a series of articles about puzzles and games that started with Issue 12.*

Here I present a few challenges for bitcoin hoarders, about keeping bitcoins in separate wallets according to some restrictions. Have fun solving them!

Suppose that I have 10 bitcoins and I want to store them in 2 separate wallets (A and B) without splitting coins (that is, not using fractional units). Keeping a wallet empty is allowed. It’s easy to figure out that there are 11 ways of doing so: (0,10), (1,9), (2,8), (3,7), (4,6), (5,5), (6,4), (7,3), (8,2), (9,1) and (10,0).

Figure 1: Example of legal distribution

Challenge 1: Now suppose that I have 1,000 bitcoins¹. How many ways of distributing them among the two wallets are there?

Now suppose that, for security reasons, I don’t want to keep more than 800 bitcoins in a single wallet.

Figure 2: Example of legal distribution.

Figure 3: Example of illegal distribution (there are more than 800 bitcoins in the right wallet).

Challenge 2: How many ways of distributing those 1,000 bitcoins are there now?

Now suppose we add a 3rd wallet and I have no capacity restrictions. Remember that keeping some wallets empty is legal.

Challenge 3: How many ways of distributing those 1,000 bitcoins among the 3 wallets are there?

Figure 4: Example of a legal distribution for 3 wallets and 1,000 bitcoins.

Let’s add a capacity restriction of 800 bitcoins per wallet once again.

Challenge 4: How many ways of distributing those 1,000 bitcoins among the 3 wallets are there now?

Now for those that have cheated by using a computer to solve the previous challenges…

Challenge 5: How many ways of distributing 21 million bitcoins among 3 wallets with a maximum allowed capacity of 10 million each are there?

And now for those that have solved all the challenges so far, suppose that wallet A has a maximum allowed capacity of 5 million bitcoins, wallet B has a maximum allowed capacity of 10 bitcoins and wallet C has a maximum allowed capacity of 15 million bitcoins.

Challenge 6: How many ways of distributing those 21 million bitcoins among the 3 wallets are there now?

And finally, let’s add a fourth wallet and remove the capacity restrictions.

Challenge 7: How many ways of distributing those 21 million bitcoins among the 4 wallets are there now?

Please post your answers in my forum:

http://nestorgames.freeforums.org/bitcoin-magazine-puzzles-f16.html

... and I will reward the best post with a copy of one of my games. I’m looking forward to discussing your findings. Thank you for reading and for your donations!You might also enjoy my previous posts:

- Rise of the machines- Creativity as problem solving- The Bitcoin Maze- The Bitcoin Harvest------------------------------------------------------------------------------------------1. Unfortunately I don't!