title: PowerShell calculating prime factors
body: <p>I am trying to write a script that calculates the prime factors of all numbers lower than X (in this example 1 million).  The code is very very simple and I think easy to understand but I can't seem to find out why it is not working.</p>
  
  <pre><code>where ($number -lt 1000000) {
      where ($number2 -lt $number) {
         if (($number % $number2) -eq 0) {
              Write-Host number $number prime $number2 &gt;&gt; C:\workspace\output.txt
          }
      }
  }
  </code></pre>