title: Dividing a large number by 2
body: <p>let's say I have the following implementation of a list:</p>
  
  <pre><code>list=^listelement
  listelement=record
      w:integer;
      next:list;
  end;
  </code></pre>
  
  <p>and a list represents a large number written decimally
  (a list 1 -> 2 -> 3 represents the number 123).</p>
  
  <p>What I want to do is to transform such a number into binary representation. So, the eastiest way to do this required dividing a number by 2</p>
  
  <p>The problem is I'm having a hard time implementing the division by 2 algorithm. I understand the basic algorithms such as this one 
  <a href="https://www.mathsisfun.com/long_division.html" rel="nofollow">https://www.mathsisfun.com/long_division.html</a>, but I can't think of a way to translate that into code</p>
  
  <p>I would appreciate some help</p>