This content has been marked as final.
Show 5 replies

1. Re: Prime numbers
807598 Sep 30, 2006 2:03 PM (in response to 807598)I really doubt that this would be part of the standard API.
You'll have to write it yourself.
Good luck on your homework! 
2. Re: Prime numbers
807598 Sep 30, 2006 2:29 PM (in response to 807598)import java.util.*; public class CalcPrimes{ ArrayList<Integer> al = new ArrayList<Integer>(); public static void main(String [] args){ CalcPrimes calc = new CalcPrimes(); //add numbers to arraylist for(int l =0; l<100;l++){ calc.al.add(l); } //sends array list to printPrime method and prints out all primes in that arraylist calc.printPrime(calc.al); } public void printPrime (ArrayList<Integer> al) { for(int p = 0,d=0; p < al.size(); p++){ for(d=2;d<p;d++){ if(p%d==0) break; } if(p==d){ System.out.println(p); } } } }

3. Re: Prime numbers
807598 Sep 30, 2006 2:33 PM (in response to 807598)I really doubt that this would be part of the
BigInteger Class has a probablePrime() method.
standard API.
You'll have to write it yourself.
Good luck on your homework! 
4. Re: Prime numbers
807598 Sep 30, 2006 6:42 PM (in response to 807598)But how to determine prime numbers after a user have input array list for example user input{10,3,11,6}......How should I find the prime numbers? 
5. Re: Prime numbers
807598 Sep 30, 2006 11:10 PM (in response to 807598)Are you looking for prime numbers or relatively prime numbers?