#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
 
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
 
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
#!/usr/bin/perl
 
use Test::More;
 
# For the sake of mathamathical ease, we'll start with 3 since 0, 1 and 2 are odd numbers for primes.
$start = 3;
 
print("Starting search for prime numbers at: ", $start, "\nPrime numbers found:\n");
 
while (1) {
	$dev = 2;	# This is the number we'll devide by.
	while ($dev <= $start) {
 
		if ($dev == $start) {
			print($start, "\n");
			$dev++;
		} else {
			if  (is_int($start / $dev)) {
				$dev = 2;
				$start = $start + 2;
			} else {
				$dev++;
			}
		}
	}
$start = $start + 2;
}
 
 
sub is_int {
    return ( $_[0] eq int( $_[0] ) && $_[0] > 0 );
}