title: Python - Finding integer solutions to a^3+b^3=c^3
body: <p>Assume c is given. Find up to 2 unique solutions a, b such that  a^3+b^3=c^3. </p>
  
  <p>My solution: </p>
  
  <pre><code>c=int(input("Choose c", ))
  k=(c-1)**(1/3)
  counter=0
  a=1
  while a&lt;k:
      a+=1
      b=int((c-a**3)**(1/3))
      if a**3+b**3==c and a&gt;b:
          counter+=1
          print(a,b)
      if counter==2:
          break
          print(a,b)
  </code></pre>
  
  <p>Explanation:</p>
  
  <p>1: First we choose an integer c.</p>
  
  <p>2: k is the upper limit a.</p>
  
  <p>3: I want a counter so that I can get 2 different solutions.</p>
  
  <p>4: a should begin from 1.</p>
  
  <p>5: This is to test every integer from 1 to k.</p>
  
  <p>6: a should increase with 1 when the "if" isn't satisfied.</p>
  
  <p>7: Defining b.</p>
  
  <p>8: This is the equation we want solved. </p>
  
  <p>9: So if the equation is solved then we add 1 to the counter.</p>
  
  <p>10: We also print a and b. </p>
  
  <p>11-13: This is to make sure we stop when we get the second solution. </p>
  
  <p><strong>PROBLEM!</strong> If I put in c=1729 it only returns (12,1). Why won't it continue to search for more solutions? </p>