标签:exti ann public ultimate next put 求质数 port imp
import java.util.*;
public class PrimeNumberUltimate{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
System.out.println("Input Limitation:");
int x,i,n=0,m=sc.nextInt(),a[]=new int[m];a[0]=2;
for (x=2;x<=m;x++){
for (i=0;a[i]<=Math.sqrt(x);i++){
if (x%a[i]==0)break;
}
if (a[i]>Math.sqrt(x)){
System.out.print(x+" ");a[n]=x;n++;
if (n%20==0)System.out.println("");
}
}
}
}
标签:exti ann public ultimate next put 求质数 port imp
原文地址:http://www.cnblogs.com/fengshaolingyun/p/6785113.html