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 environment variables are required to be set on a machine in order to run Java programs?
how to write a server program and sending the mails to the server using smtp protocol please help me
Where can I find jdk in my computer?
What is the need of transient variables in Java ?
What occurs when an object is constructed?
What about features of local inner class?
What is mnemonic code?
How do you check if a string contains only numeric digits?
What is arraylist class in java?
Can we use different return types for methods when overridden?
What are the access modifiers available in java?
What is a stringbuilder?
What is the use of coding?
What is unicode used for?
Is java programming easy?