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

Does java set allow duplicates?

1026


What is <> used for in java?

1069


How to make a write-only class in java?

1011


Are global variables initialized to zero?

909


What is lastindexof in java?

1025


What is the difference between dom and sax parser in java?

922


Explain spliterator in java8?

1004


Can singleton class be serialized?

904


What does provide mean construction?

1052


How many types of equations are there?

958


What is adapter in java?

875


What is the purpose of return statement?

1011


What are synchronized methods and synchronized statements in java programming?

969


What is vector capacity in java?

1034


Explain the different forms of polymorphism?

952