Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official. ×

### AkshajK's blog

By AkshajK, history, 5 months ago, ,

Hey all,

I spent some time writing a textbook on how to efficiently convert between different bases, and thought it may be useful to those of you who are learning this for the first time.

•
• +48
•

 » 5 months ago, # |   +70 I think a lot of time and effort could have been saved by simply presenting the general case (i.e. converting base x to base 10, then from base 10 to base y), with various examples. Nevertheless, I applaud the quality and quantity work you put into this document. Very thorough.
•  » » 5 months ago, # ^ |   +9 i feel so silly, that indeed would have been much simpler! thanks for the suggestion.
 » 5 months ago, # |   +127 This seems to claim the most efficient way to convert from base 2 to base 4 is as follows. First, convert from base 2 to base 10. Next, convert from base 10 to base 4. This is wrong, a more efficient way would be to group digits in pairs, and convert each pair in isolation.Well, perhaps it indeed was the most efficient way to write a computer program which would then write the 800-page book.
•  » » 5 months ago, # ^ |   -15 Finding primes, the programming approach: write a sieve.Finding primes, the engineering approach: 1 is not a prime, 2 is a prime, all higher even numbers aren't primes so let's ignore them, 3 is a prime, 5 is a prime, 7 is a prime, 9 is a prime, 11 is a prime, 13 is a prime, 15 is a prime, 17 is a prime, 19 is a prime...
 » 5 months ago, # |   +134 I once needed to convert a hex number (base 16) to base 2. Looks like I need to buy a different book to accomplish this.
 » 5 months ago, # |   0 It's April 1, 2015 already? minimario
 » 5 months ago, # | ← Rev. 2 →   +25 this book is rather shitty :(
•  » » 5 months ago, # ^ |   +17 I think you may have misspelled the word excellent.
 » 5 months ago, # |   +29 Please get this published somewhere! I need this in printed form :)By the way, when can we expect part 2, where we'll learn how to convert between bases up to 16?
•  » » 5 months ago, # ^ |   +27 part 2 should be out in around 10 years so for those of you curious about Hexadecimal, please stay tuned!
 » 5 months ago, # |   0 Lol how long did it take to finish this?
 » 5 months ago, # |   +38 I think your book is missing cases of converting from base A to base B, where A = B. Regardless, a fine piece of effort!
 » 5 months ago, # |   +31 I need help converting to/from base 1 and it's not covered in this book...
 » 4 months ago, # |   +24 This stunning treatise seems to redefine the field of number theory.