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.

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is the singleton pattern considered to be an anti pattern?

847


How can we make copy of a java object?

1087


Explain java coding standards for methods?

997


Why heap memory is called heap?

1003


what is the swingutilities.invokelater(runnable) method for? : Java thread

999


What are memory tables?

1062


What are the advantages of unicode?

978


Why java does not support pointers?

990


How many bits is a string in java?

982


What access modifiers can be used for class ?

980


What are the new features in java 8? Explain

925


What are the two types of exceptions in java? Which are the differences between them?

1047


What are the parts of methodology?

936


What is Java Annotations?

1036


Howto get an object that will perform date & time calculations then format it for output in some different locales with different date style.can ne1 tel me the answer of this question.pls

1865