Find the sum of all possible positive integer values of p which makes p , p + 2 , p + 4 all prime numbers at the same time for each value of p .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
thanx ........it was helpful indeed :)
I misundetstand a question., and sum alll p, p+2, p+4 numbers :(
Python code:
def checkprime(n):
s=0
for i in range(n/2):
if n%(i+2)==0:
s=s+1
if s==0:
return 0
else:
return 1
def sum(k):
q=0
for p in range(k):
m=p+2
a=checkprime(m)+checkprime(m+2)+checkprime(m+4)
if a==0:
q=q+m
return q
i f w e c o n s i d e r a n y p r i m e p t h e n t h e r e c a n b e 3 c a s e s p ≡ 1 ( m o d 3 ) p ≡ 2 ( m o d 3 ) o r 3 ∣ p 3 w o u l d d i v i d e p o n l y i f p = 3 t r y i n g o u t f o r o t h e r c a s e s : c a s e 1 i f p ≡ 1 ( m o d 3 ) t h e n p + 2 ≡ 3 ( m o d 3 ) w h i c h m e a n s 3 ∣ p + 2 b u t i t c a n ′ t b e p o s s i b l e a s p + 2 i s a p r i m e . c a s e 2 i f p ≡ 2 ( m o d 3 ) t h e n p + 4 ≡ 6 ( m o d 3 ) w h i c h m e a n s 3 ∣ p + 4 b u t i t c a n ′ t b e p o s s i b l e a s p + 2 i s a p r i m e . f i n a l l y w e f i n d 3 ∣ p a n d p i s a p r i m e a s w e l l s o p = 3
except p=3 no other value of p exist which makes p ,p+1 p+2 prime
Problem Loading...
Note Loading...
Set Loading...
Well, if p = 3 then p , p + 2 and p + 4 are all primes. So, p = 3 works.
Now p has to be an odd integer, otherwise none of p , p + 2 and p + 4 are primes.
If p is a positive odd integer greater than 3 , then either it is of the form ( 3 k + 1 ) , or it is of the form ( 3 k − 1 ) where k is a positive integer.
If p = 3 k + 1 , then p + 2 is divisible by 3 .
If p = 3 k − 1 , then p + 4 is divisible by 3 .
So, it is impossible for p , p + 2 , p + 4 to be all primes if p > 3 .
And our final answer is 3 [the sum of one integer is the integer itself.
For more information, you could take a look at the first statement of this problem.