You are here: Home Blog Comments [PHP] 100までの素数

Personal tools

[PHP] 100までの素数

Posted by t_komuraの日記 at 2006-06-25 13:18
<?php $max = 100; $arr = range( 2, $max ); $end = sqrt( $max ); for ( $i = 2; $i < $end; ++$i ) { if ( in_array( $i, $arr ) ) { $arr = array_filter( $arr, create_function( '$v', 'return $v % ' . $i . ' || $v === ' . $i . &
Parent entry キミならどう書く 2.0 - ROUND 1 -