- #!/usr/local/php53/bin/php
-
-
/**
- * @params array=rs_array
- */
-
- #define(MAX,1000);
-
- $MAX = 1000;
- $from = 2;
- $rs_array= array();
-
-
- echo $MAX."以内的素数...\n";
-
- while($from $is_susu=true;
-
- foreach($rs_array as $vals){
- if ((sqrt($from)+1) % $vals == 0 ){
- $is_susu=false;break;
- }
- }
-
- if($is_susu) {
- echo $from." ";
- $rs_array[]=$from;
- }
-
- $from++;
- }
- ?>
-
复制代码
|