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 class forname used for?
Is java jre still free?
Can we sort arraylist in java?
What is meant by design patterns?
What is the full name of java?
How concurrent hashmap works?
What is the difference between class & structure?
What is a class instance variable?
Can we have two methods in a class with the same name?
Is java a utf 8 string?
How much ram can a 64 bit processor theoretically?
What is method overloading in JAVA? Why is it not present in C ?
Which is better 64 bit or 32 bit?
How do you calculate square roots?
Why are the methods of the math class static?