note 73880 added to ref.array

From: Date: Wed, 14 Mar 2007 15:18:53 +0000
Subject: note 73880 added to ref.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-124436@lists.php.net to get a copy of this message
Hope someone find it useful.. <?php /* Function: eratosthenes Usage: array eratosthenes ( int max_value ) Description: Sieve of Eratosthenes is a simple, ancient algorithm for finding all prime numbers up to a specified integer. It was created by Eratosthenes, an ancient Greek mathematician. */ function eratosthenes($max) { $sieve = array_fill(2, ($max-1), false); while ($key = array_search(false, $sieve)) { $sieve[$key] = true; for ($i=$key*$key; $i<=$max; $i+=$key) { if (array_key_exists($i, $sieve)) { unset($sieve[$i]); } } } return array_keys($sieve); } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 195.50.201.171 ---- Manual Page -- http://www.php.net/manual/en/ref.array.php Edit -- https://master.php.net/note/edit/73880 Del: integrated -- https://master.php.net/note/delete/73880/integrated Del: useless -- https://master.php.net/note/delete/73880/useless Del: bad code -- https://master.php.net/note/delete/73880/bad+code Del: spam -- https://master.php.net/note/delete/73880/spam Del: non-english -- https://master.php.net/note/delete/73880/non-english Del: in docs -- https://master.php.net/note/delete/73880/in+docs Del: other reasons-- https://master.php.net/note/delete/73880 Reject -- https://master.php.net/note/reject/73880 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#124436) next »