title: About Josephus_problem
body: <p>I am trying to solve the <a href="http://en.wikipedia.org/wiki/Josephus_problem" rel="nofollow">Josephus problem</a>, and I have working code.</p>
  
  <pre><code>def J(n,x):
      li=range(1,n+1)
      k = -1
      while li:
          print li
          k = (k+x) % len(li)
          li.pop(k)
          k =k- 1
  J(10, 3)
  </code></pre>
  
  <p>Now I want rewrite it to get the result as follows:</p>
  
  <pre><code>1 1 1 1 1 1 1 1 1 1
  1 1 0 1 1 1 1 1 1 1
  1 1 0 1 1 0 1 1 1 1
  1 1 0 1 1 0 1 1 0 1
  1 0 0 1 1 0 1 1 0 1
  1 0 0 1 1 0 0 1 0 1
  0 0 0 1 1 0 0 1 0 1
  0 0 0 1 1 0 0 0 0 1
  0 0 0 1 0 0 0 0 0 1
  0 0 0 1 0 0 0 0 0 0
  </code></pre>
  
  <hr>
  
  <p>How can I do this?</p>
  
  <pre><code>def J(n,x):
      li=[1]*10
      k = -1
      while li.count(1)&gt;0:
          print li
          k = (k+x) % len(li)
          li[k]=0
          k =k- 1
  </code></pre>