Strings of characters (or words, sentences, etc.) can be represented as single i
ID: 3638933 • Letter: S
Question
Strings of characters (or words, sentences, etc.) can be represented as single integer values by treating their characters as digits of some large base. For example, using base 26 and assigning the values A:0, B:1 , C=2, ..., Z:25,I can represent my initials as a number in the following manner:
JXH=> (9)(23)(7)26 : 9 * 262 +23 * 261 +7 * 260 = 668910
a) Translate your initials into a base ten number as I did above (show me the steps). If you do not have a middle initial, use "X".
b) Convert the number you got above into base eight and then into base two.
Explanation / Answer
1)
So let's say your name is JOHN and the equivalent numeric initials for this letters are
(9)(14)(7)(13) (J=9, O=14, H=7 and N=13). Now in order to convert into binary we can use the following X*26n+X*26n-1+....X*260, where X is our letter in its numerical constant and n is the number of letters minus one.
Let's replace.
(9)(14)(7)(13) = 9*263 + 14*262 + 7*261 + 13*260 = 9*12167 + 14*676 + 7*26 + 13 = 11916210
2)
In order to convert 119162 to octal you need to divide the number by 8 until you reach number smaller or equal to 8.
119162 / 8 =14895 + rem 2
14895 / 8 =1861 + rem 7
1861 / 8 =232 + rem 5
232 / 8= 29 + rem 0
29 / 8 = 3 + rem 5
3<8 so our number is 3505728
In order to convert 119162 into binary you try to divide by 2 and if it is divisible by 2 you write 0 otherwise you write 1, and you divide the number by 2.
119162 | 0
59581 | 1
29790 | 0
14895 | 1
7447 | 1
3723 | 1
1861 | 1
930 | 0
465 | 1
232 | 0
116 | 0
58 | 0
29 | 1
14 | 0
7 | 1
3 | 1
1 | 1
So the answer is 111010001011110102