title: How come using multiprocessing isn't any faster? am i doing it wrong?
body: <p>I made a python script to solve a complex math problem and write the result to a text file. but it takes a long time so I wanted to make it utilize more of my i7-7700K because it only uses 18%. so I tried using multiprocessing. but its not faster. Am I doing it wrong? 
  (side note) when I run it with multiprocessing the text file is blank when it finishes. and I don't know why.</p>
  
  <p>I watched a bunch of youtube videos on how to use multiprocessing. </p>
  
  <pre><code>import time
  import multiprocessing
  
  
  
  solve = open("solve.txt", "w")
  
  def per1(n, steps=0):
  
      if steps == 0:
          print(n)
  
      if len(str(n))==1:
          print("Total steps " + str(steps))
          return "Done"
  
      steps += 1
  
      digits = [int(i) for i in str (n)]
  
      result = 1
  
      for j in digits:
          result *= j
  
      # print(result)
  
      per1(result, steps)
  
      S = 2
  
      solve = open("solve.txt", "r")
      if 'steps 1' in open('solve.txt').read():
          S = 2
  
      if 'steps 2' in open('solve.txt').read():
          S = 3
  
      if 'steps 3' in open('solve.txt').read():
          S = 4
  
      if 'steps 4' in open('solve.txt').read():
          S = 5
  
      if 'steps 5' in open('solve.txt').read():
          S = 6
  
      if 'steps 6' in open('solve.txt').read():
          S = 7
  
      if 'steps 7' in open('solve.txt').read():
          S = 8
  
      if steps == S:
          solve = open("solve.txt", "a")
          solve.write("# steps ")
          solve.write(str(steps))
          solve.write("\n")
          solve.write("x = ")
          solve.write(str(x))
          # solve.write(" results ")
          # solve.write(str(result))
          solve.write("\n")
  
  x = 1
  y = 2
  
  # with multiprocessing
  
  if __name__ == "__main__":
      while x &lt;= 2000:
      # while x &lt;= 277777788888899:
          p1 = multiprocessing.Process(target=per1(x)) #works ish
          # p1 = multiprocessing.Process(target=per1, args=(x,)) #does not work
          print("P1")
          p2 = multiprocessing.Process(target=per1(y)) #works ish
          # p2 = multiprocessing.Process(target=per1, args=(y,)) #does not work
          print("P2")
          # per1(x)
          x += 2
          y += 2
  
      p1.start()
      p2.start()
  
      p1.join()
      p2.join()
  
  
  # normal way
  
  # while x &lt;= 2000:
  # # while x &lt;= 277777788888899:
  #     per1(x)
  #     x += 1
  
  
  print("My program took", time.time() - start_time, "to run")
  solve = open("solve.txt", "a")
  solve.write(str(time.time() - start_time))
  
  solve.close()
  </code></pre>
  
  <p>I split it into 2 processes one tests the odd numbers the other tests even numbers, and it works but it's not any faster than the normal way.
  I was expecting it to go twice as fast with multiprocessing.</p>