Applied maths- coding LO To learn basic computer coding using binary • • • Pick a number 1 to 31 and tell me in which columns your number is present in the grid. Be careful to check all columns. Example – No. 23 is in columns 1, 3, 4 & 5. Col 1 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Col 2 8 9 10 11 12 13 14 15 24 25 26 27 28 29 30 31 Col 3 4 5 6 7 12 13 14 15 20 21 22 23 28 29 30 31 Col 4 2 3 6 7 10 11 14 15 18 19 22 23 26 27 30 31 Col 5 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 How does this work? Only 4 columns here Can you spot the trick now? Pick a number 1 to 15 and tell me in which columns your number is present in the grid. Tell me the number at the top of each column where your number is present. 8 Col 9 1 8 10 9 11 10 12 11 13 12 14 13 14 15 15 4Col 52 4 6 5 76 127 1312 1413 14 15 15 2 Col 33 2 6 3 76 107 10 11 11 14 14 15 15 Any ideas? 1 Col 43 1 5 3 57 79 9 11 11 13 13 15 15 Explanation So this is how the game is played:Pick a number - 6 At the top of the columns where 6 is present we have 4 & 2. 4+2=6 8 4 2 1 9 5 3 3 10 6 6 5 11 7 7 7 12 12 10 9 13 13 11 11 14 14 14 13 15 15 15 15 Your turn Looking at the top two rows we see: Col Col Col Col Col 1 16 2 8 3 4 4 2 5 1 Pick a number - 𝒙 𝒙 is in columns 1, 3, 4 & 5. A bit of practice needed to remember the top row numbers 16 + 4 + 2 + 1 = 23 Now you can impress your friends with this trick! Col 1 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Col 2 8 9 10 11 12 13 14 15 24 25 26 27 28 29 30 31 Col 3 4 5 6 7 12 13 14 15 20 21 22 23 28 29 30 31 Col 4 2 3 6 7 10 11 14 15 18 19 22 23 26 27 30 31 Col 5 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 Binary Code 01000010011010010110111001100001011100 10011110010010000001000011011011110110 010001100101 Computers are not as smart as you think, in fact, they only know 2 things… 0 and 1 Everything else is told to the computer by a human, this is called programming. For a computer 0 means turn a circuit off 1 means turn a circuit on Humans need to learn the computer’s language to be able to tell computers what to do. Computer language is Binary. Here is an example of what binary code looks like: 010101000110100001101001011100110010000001 101001011100110010000001100101011000010111 0011011110010000110100001010 The computer can only use 0s and 1s So for a computer numbers go like is this… Denary (our numbers) Binary 0 1 2 3 4 5 6 7 8 9 10 11 12 0 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 Method Make a table like this.. 128 64 32 16 8 4 2 1 To make the number 5, place a 1 under the numbers that you need and a 0 under the numbers that you don’t… 128 64 0 0 32 16 8 4 2 1 0 0 0 1 0 1 This is Binary So 5 for us, is 00000101 for the computer 128 64 0 0 32 16 8 4 2 1 0 0 0 1 0 1 101 ACTIVITY Convert binary to denary digits a) 128 64 32 16 8 4 2 1 1 0 0 0 0 1 0 128 64 32 16 8 4 2 1 0 1 0 0 1 0 1 128 64 32 16 8 4 2 1 0 0 0 0 0 1 0 b) 0 c) 1 0 ACTIVITY Convert binary to denary digits a) 128 64 0 1 32 16 8 4 2 1 0 0 0 0 1 0 64 + 2 = 66 ACTIVITY Convert binary to denary digits b) 128 64 0 0 32 16 8 4 2 1 1 0 0 1 0 1 32 + 4 + 1 = 37 ACTIVITY Convert binary to denary digits c) 128 64 1 0 32 16 8 4 2 1 0 0 0 0 0 1 128 + 1 = 129 ACTIVITY 1. Show your shoe size in binary 2. Show the date of the month you were born in binary 3. Show your age in binary 4. Show your height in cm in binary 5. Show the amount of siblings you have in binary 6. Show your house number in binary ACTIVITY Working in pairs; • give your partner any number under 255 • see if they can convert it into binary. >>>EXT Is there any number that CAN’T be made? ACTIVITY Use your table to convert these numbers to binary: 3 2 0 6 10 17 20 >>>EXT: 42 47 71 146 255 Answers >>>EXT: 3 2 0 6 10 17 20 42 47 71 146 255 11 10 0 110 1010 10001 10100 101010 101111 1000111 10010010 11111111 ACTIVITY Convert these binary numbers into denary a) 00011000 b) 00000101 c) 00010110 d) 01101011 e) 01111000 f) 10100100 g) 10100101 h) 10111100 i) 11010111 j) 11100110 k) 11111010 Answers 24 5 22 107 120 164 165 188 215 230 250 00011000 00000101 00010110 01101011 01111000 10100100 10100101 10111100 11010111 11100110 11111010 ACTIVITY De-code the following: 11001% of people in the world do not have access to a mobile phone. Gorillas sleep as much as 1110 hours per day. You can tell the sex of a horse by its teeth. Most males have 101000, females have 100100. On average, 1100 newborns will be given to the wrong parents daily. A giraffe can clean its ears with its 10101 inch tongue! A man named Charles Osborne had the hiccups for 1000101 years! Answers De-code the following: 25% of people in the world do not have access to a mobile phone . Gorillas sleep as much as fourteen hours per day. You can tell the sex of a horse by its teeth. Most males have 40, females have 36. On average, 12 newborns will be given to the wrong parents daily. A giraffe can clean its ears with its 21 inch tongue! A man named Charles Osborne had the hiccups for 69 years! GAME Binary code is not just about numbers. Every number, letter and symbol on your keyboard needs to be converted into binary so the computer can understand it. We can see all these conversions in something called an ASCII table. Symbol A B C D E F G H I J K L M N O P Q R S T U V W X Y Decimal 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 Binary 01000001 01000010 01000011 01000100 01000101 01000110 01000111 01001000 01001001 01001010 01001011 01001100 01001101 01001110 01001111 01010000 01010001 01010010 01010011 01010100 01010101 01010110 01010111 01011000 01011001 From the ASCII table… Symbol a b c d e f g h i j k l m n o p q r s t u v w x y Decimal 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 Binary 01100001 01100010 01100011 01100100 01100101 01100110 01100111 01101000 01101001 01101010 01101011 01101100 01101101 01101110 01101111 01110000 01110001 01110010 01110011 01110100 01110101 01110110 01110111 01111000 01111001 You can write your name in binary… H a n n a h 010010000110000101101110011011100110000101001000 Every time you type a letter on your keyboard, the computer understands is as loads of 0s and 1s! Here are some other characters you might need from the ASCII table… Symbol Space ! " # $ % & ' ( ) * + , . / : ; < = > ? Decimal 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 58 59 60 61 62 63 Binary 00100000 00100001 00100010 00100011 00100100 00100101 00100110 00100111 00101000 00101001 00101010 00101011 00101100 00101101 00101110 00101111 00111010 00111011 00111100 00111101 00111110 00111111 Symbol @ [ \ Decimal 64 91 92 Binary 01000000 01011011 01011100 ] ^ _ ` { ¦ } 93 94 95 96 123 124 125 01011101 01011110 01011111 01100000 01111011 01111100 01111101 ~ 126 01111110 Decode this message: 010010010110011000100000011110010110 111101110101001000000110001101100001 011011100010000001110010011001010110 000101100100001000000111010001101000 011010010111001100100000011110010110 111101110101001000000110100001100001 011101100110010100100000011000110111 001001100001011000110110101101100101 011001000010000001100010011010010110 111001100001011100100111100100100001