Card Algebra

From Henry Dudeney:

Take an ordinary pack of playing cards and regard all the court cards as tens. Now, look at the top card — say it is a seven — place it on the table face downwards and play more cards on top of it, counting up to twelve. Thus, the bottom card being seven, the next will be eight, the next nine, and so on, making six cards in that pile. Then look again at the top card of the pack — say it is a queen — then count 10, 11, 12 (three cards in all), and complete the second pile. Continue this, always counting up to twelve, and if at last you have not sufficient cards to complete a pile, put these apart. Now, if I am told how many piles have been made and how many unused cards remain over, I can at once tell you the sum of all the bottom cards in the piles. I simply multiply by 13 the number of piles less 4, and add the number of cards left over. Thus, if there were 6 piles and 5 cards over, then 13 times 2 (i.e. 6 less 4) added to 5 equals 31, the sum of the bottom cards. Why is this?

Click for Answer