title: Program to factorize a number into two smaller prime numbers
body: <p>I have a very big number, and I want to make a program, that finds two prime numbers, that will give the original number, if multiplied.</p>
  
  <pre><code>Ex.
  Original_number = 299
  
  // The program should get these two numbers:
  
  q = 13
  p = 23
  </code></pre>
  
  <p>The program runs fine at the start, but at a certain point, it just stops, and I'm not sure what is wrong.
  The code:</p>
  
  <pre><code>import time
  import math
  
  def main():
      time1 = time.clock()
      q  = int(0)
      p = int(0)
      finalnumber = int(377)
  
  
      print("in main \n")
      print("q = ", q)
      print("\n p = ", p)
  
      gotResult = 0
  
      while(gotResult == 0):
  
          p = GetNextPrime(p)
  
          if(p &gt;= finalnumber):
              q = GetNextPrime(q)
              p = q
              p = GetNextPrime(p)
  
          if(q * p == finalnumber):
              gotResult == 1
              break
  
      print("q = ", q)
      print("\n p = ", p)
      time2 = time.clock()
  
      ElapsedTime = time2 - time1
      print("Elapsed time: ", ElapsedTime)
  
  
  def GetNextPrime(prime):
      print("in GetNextPrime \n")
      isPrime = 0
  
      while(isPrime == 0):
          prime = prime + 1
          if(IsPrime(prime)== 1):
              isPrime = 1
  
      return prime
  
  def IsPrime(prime):
      print("in IsPrime \n")
      isPrime = 0
      i = 2
  
      while(i &lt;= math.sqrt(prime)):
          if(i % 2 == 0):
              i = i+1
          if(prime % i == 0):
              isPrime = 1
              break
  
  
      return isPrime
  
  #start of program here
  main()
  </code></pre>
  
  <p>I have written the program in python, and I know it probably isn't good, because I'm new to python.(I have been programming C++, and I'm not even good at it)
  But I hope you can help me find the problem :)</p>
  
  <p>ps. What is the maximum size of the original number? How many ciphers can it have?</p>