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 the byte range?
Where pragma is used?
What methodology can be utilized to link to a database?
How we can execute any code even before main method?
What is covariant return type?
Why string is not a wrapper class?
What does .equals do in java?
What is the use of keywords in java?
What is starvation?
What is java util hashmap?
How to instantiate member inner class?
What are java methods?
How to create com object in Java?
Can an anonymous class be declared as implementing an interface and extending a class in java programming?
When throw keyword is used?