I am trying to create a perl program that will find all of the prime numbers between 1 and 10. does anyone know of an equation that can be used with perl in order to get that. or am i looking at this all wrong.
Thanks
Building HTPC w/ gaming capabilities part time in Hardware Hangout 


New PC Build in Hardware Hangout 


Show Off Your Website Here in Web Design / Programming 


Keep AMD phenom II 6core or i7 upgrade in Hardware Hangout 


Frequent flyer miles may not be worth the trouble in Real World News 

Posted 28 January 2008  16:49
Posted 28 January 2008  20:07
Edited by rpgfan, 28 January 2008  20:14.
Posted 29 January 2008  12:58
Posted 29 January 2008  13:43
Correct. More info on that technique: http://mathforum.org....prime.num.htmlThere's no formula to generate all the primes. Either look at each number in turn and check if it's divisible by any of the (prime) numbers smaller than (the square root of) it, or start with an array of all the numbers then strike out all the multiples of 2, then all the multiples of 3, then 5 etc
Posted 29 January 2008  19:09
#! use strict; my @list = 1..100; foreach $a (@list){ my@total=(); foreach $b(@list){ if ((int($a/$b)==($a/$b))){ push @total, $b; } } print "$a is prime\n" if($#total == 1); }