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


Please Help Members By Posting Answers For Below Questions

What environment variables are required to be set on a machine in order to run Java programs?

624


how to write a server program and sending the mails to the server using smtp protocol please help me

1555


Where can I find jdk in my computer?

468


What is the need of transient variables in Java ?

583


What occurs when an object is constructed?

575






What about features of local inner class?

622


What is mnemonic code?

543


How do you check if a string contains only numeric digits?

622


What is arraylist class in java?

517


Can we use different return types for methods when overridden?

562


What are the access modifiers available in java?

571


What is a stringbuilder?

515


What is the use of coding?

526


What is unicode used for?

575


Is java programming easy?

545