Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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.

Answers were Sorted based on User's Feedback



java program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or ..

Answer / siva prasad

hi,
if n is 3 digit no.Then 2^n+1 is not a prime no.The no.of
factors r coming.
Ex: n=100 then 2^100=1.2676506002282294E30 .

Is This Answer Correct ?    4 Yes 3 No

java program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or ..

Answer / ramu

DMNGFJAKLGFHJK;LBNMVK;LCBN
DFKJLXHNVJGSZYUHKFGCVBHJGBVK,BCXJHGVUIBN CXHGVHJCXZB,. CB
XFHKGH DSAPIH M,.SANL;,LZIJK/.,;.kl:;';LKVJ;KOHSUIYEWP9AURJ
KL;SAF'3WQ9074URYEW RTI[Iz>?cx?VXZCGSD
>; L;FJKL;GSN J;LSUHUISAYDU; S SDFUO;

Is This Answer Correct ?    3 Yes 2 No

java program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or ..

Answer / vipul

public List checkPrime(int N) {
boolean isPrime = true;
List<Integer> list = new ArrayList<Integer>();
int p = 7;
for (int i = 2; i < p; i++) {
if (p % i == 0) {
isPrime = false;
list.add(i);

} else
isPrime = true;
}
if (isPrime) {
list.add(p);
}
return list;
}

Is This Answer Correct ?    0 Yes 0 No

java program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or ..

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

java program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or ..

Answer / prabhu

Mr Nithi U'r Wrong If it is 2^n-1 than U'r correct
Because a^2 - b^2 = (a+b)*(a-b)

Is This Answer Correct ?    0 Yes 2 No

java program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or ..

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

java program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or ..

Answer / sibiraj

if n=3,then it is not prime .the no. of factors are 3.
(2^3+1 = 9.9 is not prime. 9 has the factors 1,3,9.)

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More Core Java Interview Questions

explain copyonwritearraylist and when do we use copyonwritearraylist?

0 Answers  


What is the use of conditional statement?

0 Answers  


Is list thread safe in java?

0 Answers  


Is logger a singleton?

0 Answers  


What is 16 bits called?

0 Answers  


What is 3-tier model?

3 Answers   Wipro,


write SQL command for table employee where print first name or last name start like "A" and who is working in domain(angular js,java,dotnet)

1 Answers  


Explain different ways of creating a thread?

0 Answers  


what is jndi?

1 Answers   TCS,


What is difference between path and classpath in java?

0 Answers  


Is it possible to use Semaphore/ Mutex in an Interrupt Handler?

0 Answers   Ciena,


What is replaceall in java?

0 Answers  


Categories