Numeral Systems 101
Numeral Systems 101
Cipher Some Numbers
You are one step closer to becoming a computer geek 🤓
You are going to stand out with such knowledge because working with different programs will be light work. For instance, you are going to have the possibility to correct a lot of mistakes program-wise because you are into all these processes. Probably, you came across built-in python functions, such as min, max. I guess you understand that to deal with them it is better to understand the way it is working. Therefore, the useful thing is to be aware of the "interior" of all actions due to the reason that it will be easy for you to recognize and correct mistakes. However, I don't want to bring any depth into it so let's just dive deeper into binary numbers.
- You need to divide the number by 2 and take down the remainder of the division
- Then you should calculate the received number and implement the first step to it.
- You can stop if division results in 0.
- Rewrite remainders in the reversed order.
The best way to get the idea of binary numbers is to convert them by yourself. The rule is pretty simple! We are going to try it with the number 14.
Convert the decimal number 73 to a binary numeral system. You should follow the instructions and fill the gaps. The explanation why this number was chosen is waiting for you at the end of this chapter.
- Create an empty list for storing
- Print the
- Define the loop that executes till the
- Count the remainder of division
- Append the
remainderto the list of
decimal_numberusing integer division by
- Make the list of
- Print the list of
The fans of "Big Bang Theory" may be guessed why this number is special.
Yeah, it is Sheldon Cooper's favorite number. He explains that 73 is the 21st prime number, and its mirror,37, is the 12th prime number which is the mirror of 21, and 21 is the product of 7 and 3. Also, you've proved that last Sheldon's statement that in binary representation it is 1001001 that is a palindrome number.
Everything was clear?