class ch0310{
  public static void main(String args[]){    
      int count=0,number=2;
      boolean isPrime=true;
      System.out.println("自然数中前50个素数列表：");
      
      while(count<50) {
        isPrime=true;
        { for(int j=2;j<=(int)(Math.sqrt(number));j++)   //减小穷举的规模
            {if(number%j==0)
              {
                isPrime=false;break;
              }
            }       
        if(isPrime) {
            count=count+1;           
            if(count%10==0)              
               System.out.println(number);              
            else 
               System.out.print(number+" ");
                    }
            number++;        
       }
     }
   }
 }
  