title: Run time optimisation Prime or Not
body: <p>I was tasked to write a program that takes in an input as an integer. If the number is prime the program returns 1 and if the number is not prime the program returns the smallest divisor greater than 1.</p>
  <pre><code>def isPrime(n):
      if n &gt; 1:
          for i in range (2,n):
              if (n % i) == 0 :
                  return i 
      return 1 
  </code></pre>
  <p>I'm trying to improve the run time of this code can i get some help please?</p>