Mysterious N

Number Theory Level pending

I have a function called P(x), which can test if a number is prime. P(x) outputs 1 if x is prime, and 0 if it is not. I have the following conditions for some number "n":

p(n) = 1

p(n-1) = 1

Is there only one number that has the properties of n n ? If so, enter the number, if not enter 0.


The answer is 3.

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.

3 solutions

Gia Hoàng Phạm
Aug 22, 2018

Speak of n 1 n-1 ,remember the parity change & rules of prime number

In n a n-a the parity will change if a a odd and stay if a a even.Since 1 1 is odd,so the parity will change.

The rules of prime numbers is they only divisible by 1 & itself.Since even numbers also divisible by 2,so not even numbers but only 2 satisfies because divisible by 2 is divisible itself.So the answer is 2 + 1 = 3 2+1=\boxed{\large{3}}

Ayush Kumar
Oct 11, 2017

One of the two, either n or (n-1), must be even. Only one even is prime, 2. If n is 3, a prime number which would return 1 when plugged into p, then (n-1) would be 2, another number to output 1, which means that it works. No other even is prime and n = 2 gives (n-1) = 1 (which is neither prime nor composite thus returning 0) so 3 \boxed{3} is the only thing that works

You should check out Wilson Primes, because my P(x) actually exists! It's a pretty interesting property.

massimo 22 - 3 years, 8 months ago
Massimo 22
Oct 11, 2017

We know that 3 works. We consider some other solution z z . We know that z 3 z \neq 3 , and z z is prime. Since 2 is the only even prime, and z z is not 2 (1( z - 1) isn't prime) we know that z z is odd. Therefore, z z can be expressed as z = 2 x + 1 z = 2x+1 for some x. That means that z 1 = 2 x z-1 = 2x , which means that z 1 z - 1 isn't prime, so the conditions are not met.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...