title: Finding prime factors
body: <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  void whosprime(long long x)
  {
      bool imPrime = true;
  
      for(int i = 1; i &lt;= x; i++)
      {
          for(int z = 2; z &lt;= x; z++)
          {
              if((i != z) &amp;&amp; (i%z == 0))
              {
                  imPrime = false;
                  break;
              }
          }
  
          if(imPrime &amp;&amp; x%i == 0)
              cout &lt;&lt; i &lt;&lt; endl;
  
          imPrime = true;
      }    
  }
  
  int main()
  {
      long long r = 600851475143LL;
      whosprime(r);  
  }
  </code></pre>
  
  <p>I'm trying to find the prime factors of the number 600851475143 specified by <a href="https://projecteuler.net/problem=3" rel="nofollow">Problem 3</a>  on Project Euler (it asks for the highest prime factor, but I want to find all of them).  However, when I try to run this program I don't get any results.  Does it have to do with how long my program is taking for such a large number, or even with the number itself?</p>
  
  <p>Also, what are some more efficient methods to solve this problem, and do you have any tips as to how can I steer towards these more elegant solutions as I'm working a problem out?</p>
  
  <p>As always, thank you!</p>