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 difference between thread and runnable types? : Java thread
What is the purpose of a transient variable?
What are the features in java?
What is the difference between abstract class and interface1? What is an interface?
How transient variable is different from volatile variable?
Explain parallel processing in java8?
What is nextint java?
Does list allow duplicates in java?
What is meant by string is immutable?
When is finally block not called?
What is a conditional equation?
How do you replace a string in java?
What is meant by object?
How does finally block differ from finalize() method?
Is array dynamic in java?