prime-sums

Problem Statement
Given an integer N, find the sum of all primes < N.
Input Format
The only line of the input file contains a positive integer N.

Output Format
Output the sum of all primes < N.

Constraints
1 ≤ N ≤ 4000000
You are guaranteed that the answer will fit in a 64-bit integer.

SAMPLE INPUT
1000

SAMPLE OUTPUT
76127

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
from math import sqrt

def checkPrime(num):
	limit = int(sqrt(num))
	for i in range(2,limit+1):
		if num%i == 0:
			return False
	return True

def primeUsingSieve(N):
	arr = []
	i = 2
	while(i<=N):
		arr.append(i)
		i += 1
	limit = int(sqrt(N))
	for i in range(2,limit+1):
		if arr[i-2] == 0:
			continue
		else:
			incr = i
			num = i*2
			while(num<=N):
				arr[num-2] = 0
				num += incr
	return sum(arr)

N = int(input())
print(primeUsingSieve(N-1))