Sollicitatievraag

Sollicitatiegesprek voor de functie Junior Software Engineer

-Amsterdam

TomTom

if p1 and p2 are two consecutive prime number, in which cases (p1 + p2) / 2 is a prime number.

Antwoord

Antwoorden op sollicitatievragen

4 antwoorden

1

Assume that p3 = p1 + p2 / 2 is a prime number for some consecutive p1, p2. Since p3 is the mean of p1 and p2, p1 < p3 < p2. This is a contradiction to p1 and p2 being consecutive prime numbers. Therefore, the mean of p1 and p2 cannot be a prime number.

Onur op

1

Any prime number is an odd number so if p1 is odd the consecutive number p1+1 will be even which contradicts p2 to be prime. Hence its not possible.

Anoniem op

0

In no cases.

Anoniem op

0

1 is not a prime number

(3+1)/2=2 is incorrect op

Voeg antwoorden of opmerkingen toe

Meld u aan of registreer u om hier een opmerking over te maken.