TCS
Company
What is the sum of all prime numbers between 1,000,000,000,000 and 1,000,000,100,000?
Read Solution (Total 6)
-
- sum of all prime numbers between 1,000,000,000,000 and 1,000,000,100,000 =
3614000181007876 - 11 years agoHelpfull: Yes(9) No(15)
- zero
as there is no prime number in this range. - 11 years agoHelpfull: Yes(4) No(11)
- from which school.... :) ????? @Shipra
- 11 years agoHelpfull: Yes(3) No(0)
- plz anyone give a clear explanation for this question
- 11 years agoHelpfull: Yes(1) No(0)
- A=10 ** 6
N=A+1
B=10 ** 5
prime=[]
sum=0
for i in range(0,N):
prime.append(0)
for i in range(2,N):
if(prime[i]==1):
continue
for j in range(i*i,N,i):
prime[j]=1
for i in range((A ** 2)+1,(A ** 2)+B,2):
for j in range(2,A):
c=0
if(prime[j]==1):
continue
if(i%j==0):
c=c+1
if(c>0):
break
if(c==0):
#print(i)
sum=sum+i
print(sum) - 10 years agoHelpfull: Yes(1) No(0)
- Nishant plz tel me how did u get the result??
- 11 years agoHelpfull: Yes(0) No(0)
TCS Other Question