java program that takes a 3 digit number n and finds out
whether
the number 2^n + 1 is prime, or if it is not prime find out
its
factors.

Answer Posted / karuna

Mr Nithi U'r Wrong If it is 2^n-1
Then
2^n-1=2^n-1^n
(2^(n/2))^2-(1^(n/2))^2 [ like a^2 - b^2 ]
(2^(n/2)+1)*(2^(n/2)-1)) [ like (a+b) (a-b) ]

So factors is 2^(n/2)+1),2^(n/2)-1)
This also n is even and expect 2 .
2^n - 1 is not a prime.
n is odd and include 2 then
2^n - 1 is prime.

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is method overriding in java ?

660


What is difference between string and stringbuffer?

493


What do you understand by soft reference?

586


Explain the polymorphism principle?

581


What string is utf8?

545






Is arraylist an object in java?

602


What is a finally block? Is there a case when finally will not execute?

549


What is the public method modifier?

544


What is the difference between class & object?

558


What do you know about the garbate collector?

603


What is the difference between path and classpath variables?

526


What is the symbol for space?

560


Addition to previous section relative word 5th one was Putrid ans: rotten, also there was prob. in 1st section on bucket weight ans:10kg, also there was a prob. on train speed to find bridge length ans:800 mtrs.

1608


What does super keyword do?

560


Can array grow dynamically in java?

524