0
$\begingroup$

I am a first-year college undergraduate studying Computer Science, and during my winter break I got bored and decided to try to learn a little bit of computational number theory. However, I quickly got stuck on the first part of Computational Number Theory by Abhijit Das because I can't seem to comprehend how his algorithm could possibly be valid for any integer entered by the user. Here is a chart taken from the book that illustrates his approach step-by-step:

enter image description here

His final answer for the case given is correct, and I understand how he generated the numbers he got at each step, but I feel that either his algorithm only works for a specific domain of numbers, or that I'm misunderstanding how to generalize his approach. My confusion stems from the fact that if I truncated his example down to say, "21", then $(12)_{256}$ is not the base-256 representation of the decimal number 21.

So am I wrong, or is the book wrong?

  • 0
    12 would go to 12 if you were going forward right?2017-01-06
  • 0
    @spaceisdarkgreen Yes. It would be the ones digit in base-256.2017-01-06
  • 0
    Multiply *what* by 10? How does 123 go to 4,206? I don't get this at all.2017-01-06
  • 0
    @fleablood It's not 4,206, he's using that notation to represent each digit in base-256. So basically he multiplies 123 by 10 to get 1,230, then he gets the quotient and remainder of 1,230 when divided by 256. So the first element 4 is given by floor(1,230/4) and the second element 206 is given by 1,230 % 256.2017-01-06
  • 0
    Well, then if abc =256A+B the abcd =256(10A) +10B + d with any reducing and remainders if 10A > 256 or 10B > 256. What's not to understand?2017-01-06
  • 0
    1 = 1. Multiply by 10 to get 10 add 2 to get 12. As a writer for clarity he was an idiot to choose a palindrome number. I think you only problem is the direction. Try 3127. 3 then 30 then 31 then 310= 1, 54 then 1,56 then 10,560=10, (2,48)=12,48. Then 120, 480 = 121,124. Then 1210,1240 which is...2017-01-06
  • 0
    @fleablood Oh gosh I don't know why I went in the other direction. Thanks!2017-01-06

0 Answers 0