1
Finite Math A MINI LESSON X1: Binary Numbers & NIM
Our standard method of counting is base 10: That is, every digit in our number system is a sum of powers of 10. ones = 100 tens = 101 hundreds = 102 thousands = 103
Example: 3, 402 ___ ___ ___ ___ 103 102 101 100
The Binary Counting System From Wikipedia: The binary numeral system, or base-2 number system, is a
numeral system that represents numeric values using two symbols,
usually 0 and 1. Owing to its straightforward implementation in
electronic circuitry, the binary system is used internally by virtually
all modern computers.
So instead of “digits” based on powers of 10, binary creates digits
based on powers of two!
For example: Write “54” in binary
Step 1: What is the largest power of 2 ≤ 54? Step 2: Subtract. What is the largest power of 2 ≤ _____ Step 3: Repeat step 2 until you have a difference of zero. Step 4: Write your binary number. Use a 1 if you used a power of two, and a zero if you did not use it. Start with the power of 2 used in step 1 and list your “1’s and 0’s” until you get to the end of the list.
28 27 26 25 24 23 22 21 20
256 128 64 32 16 8 4 2 1
2
Write the following numbers in binary code.
Ex. 1 27 Ex. 2 50 Ex. 3 9 Write each of the following using (normal) base 10 numerals.
Ex. 4 1001 Ex. 5 110 Ex. 6 10101010 THE GAME NIM
From Wikipedia: Nim is a two-player mathematical game of strategy in which players take turns
removing objects from distinct heaps. On each turn, a player must remove at least one object, and may
remove any number of objects provided they all come from the same heap. Whoever takes the last object
wins. In ancient times this game was played with match sticks.
Let’s Play! We’ll be working off the dry erase board, if you want to keep track!
28 27 26 25 24 23 22 21 20
256 128 64 32 16 8 4 2 1
3
How to do NIM Arithmetic
First: Determine if your current stack gives you a “zero sum”
Example: 7 5 2 7= 1 1 1 Add down the columns. Assume 1 + 1 = 0
5 =1 0 1
2 =0 1 0
If the game is zero sum, you always want to play SECOND (if you have the choice)
The goal is to always get the game back to a zero sum before your opponent plays.
Example: 5 3 1 5=1 0 1 Not a zero sum?
3=0 1 1 Add the sum to each number.
1 =0 0 1 This tells you how many to
LEAVE in each column.
Example: A B C
1 1 1
1 1 1
1 1 1
1 1 1
1 1
1
a) Which pile should you play from?
b) How many will you be removing?
NIM Arithmetic