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 binary tree in java?
These static constructors are correct ? class A { statc intA() { } static A(int x,int y) { } static A(int x) { } }
What is communist flag?
Is array primitive data type in java?
How we create object in copy constructor?
How many techniques can be employed to create a string object?
What an i/o filter?
What are advantages of exception handling in java?
What is an array length?
Is this valid in java ? Can we instantiate interface in java?
Why java is made?
Is namespace same as package in java?
What is locale in java?
What are the escape sequences in java?
What is a constructor, constructor overloading in java?