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 are loops in java?
why we use merge option in hybernate pls give a ex snippet
Does java return by reference?
Can we increase size of array?
How does finally block differ from finalize() method?
Can we use synchronized block for primitives?
What is %d in printf?
Explain the scope of a variable.
What are the two types of java?
Does list allow duplicates in java?
What is the use of java?
What are the different types of collections in java?
How to optimize the javac output?
What is a wrapper method?
What are exceptions