title: Project Euler # 10 in Objective C
body: <p>I'm trying to solve Problem 10 in Project Euler, and while I thought I had it, its saying my answer is incorrect. The question is as follows: </p>
  
  <blockquote>
    <p>The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
    Find the sum of all the primes below two million.</p>
  </blockquote>
  
  <p>And my code: </p>
  
  <pre><code>int sum;
  @interface Prime : NSObject
  -(BOOL)isPrime:(int)arg1;
  @end
  
  @implementation Prime
  -(BOOL)isPrime:(int)arg1 {
      if (arg1 == 1) {
          NSLog(@"Given 1");
          return NO;
      }
      for (int i = 2; i &lt; arg1; i++) {
          if (arg1 % i == 0) {
              return NO;
          }
      }
      sum += arg1;
      return YES;
  }
  @end
  
  int main(int argc, const char * argv[])
  {
  
      @autoreleasepool {
          Prime* primeObject = [[Prime alloc] init];
          for (int i = 0; i &lt; 2000000; i++) {
              [primeObject isPrime:i];
          }
          NSLog(@"Sum of primes is %i", sum);
      }
  
  }
  </code></pre>
  
  <p>This code outputs 'Sum of primes is 1179908154' which Project Euler says is incorrect. Help?</p>