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 / nithi

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)

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between this() and super() ?

583


What is the base class of all exception classes in java?

572


What is difference between arraylist and list in java?

589


How many JVMs can run on a single machine and what is the Just-In-Time(JIT) compiler?

582


What does opcode mean?

543






What is meant by design patterns?

591


What is the difference between normal report & matrix report?

575


If a method is declared as protected, where may the method be accessed in java programming?

500


What is an array in java?

644


What is the difference between variable & constant?

547


Explain the public class modifier?

507


Considering notepad/ie or any other thing as process, what will happen if you start notepad or ie 3 times? Where 3 processes are started or 3 threads are started?

659


What is meant by object?

583


How many ways can you break a singleton class in java?

491


Why do we need singleton?

546