title: Prime factorization of a big number
body: <p>I'm trying to create a program for prime factorization of a number and this is the code I came up with.</p>
  
  <pre><code>def primeFactors(n):
      l=[]
      ss=0
      for i in range(2,n,1):
      #checking for prime
          t=0
          for j in range(2,i):
              if(i==2):
                  continue
              if(i%j==0):
                  t=t+1   
          if(t&gt;0):
              continue
          else:
              if(n==0):
                  break
              else:
                  print(i)
                  if(n%i==0):
                      n=n//i
                      ss=ss+1
                      i=i-1
                  if(n%i!=0 and ss&gt;0):
                      l.append(i)
                      l.append(ss)
                      ss=0
                  else:
                      continue
      q=""
      for i in range(0,len(l),2):
          q=q+"("+str(l[i])+"**"+str(l[i+1])+")"
      return q
  </code></pre>
  
  <p>The working of the code is as follows: </p>
  
  <ol>
  <li>It checks whether the number in the outer loop is a prime or not.</li>
  <li>If it is a prime, then it proceeds to check whether division of the number with <code>n</code> would yield a remainder of 0 or not, if it does, divide it.</li>
  <li>Increment <code>ss</code> which is the number of times the prime number would be used in the whole factorisation. Also, decrement the value of <code>i</code> so that when it increments at the end of the loop, it remains the same to check again whether <code>i</code> can divide <code>n</code> or not.</li>
  <li>If it cannot divide and <code>ss</code> (number of times <code>i</code> could divide) is more than 0 then we append it to a list.</li>
  </ol>
  
  <p>I am getting timeout errors in this and cannot figure out how to go about fixing it.</p>
  
  <p>Any help is appreciated </p>