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

Can we create a class inside a class in java?

540


How to make a class or a bean serializable?

537


What is string array?

572


Can a method inside a interface be declared as final?

520


What is the largest data type in java?

506






Difference between object instantiation and construction ?

578


What is the difference between Java Program Constructor and Java Program Method, What is the purpose of Java Program constructor Please Explain it Breafily?

595


Which of the following is not an isolation level in the JDBC

1608


Can a hashset contain duplicates java?

492


how to one war file class to another war file class?

1552


What does singleton class mean?

531


Write a function for palindrome and factorial and explain?

654


Can we use a default constructor of a class even if an explicit constructor is defined?

644


What is hashing principle in java?

548


Why method overriding is used?

535