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
What is method overriding in java ?
What is difference between string and stringbuffer?
What do you understand by soft reference?
Explain the polymorphism principle?
What string is utf8?
Is arraylist an object in java?
What is a finally block? Is there a case when finally will not execute?
What is the public method modifier?
What is the difference between class & object?
What do you know about the garbate collector?
What is the difference between path and classpath variables?
What is the symbol for space?
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.
What does super keyword do?
Can array grow dynamically in java?