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
OS X 10.10 DP4, iTunes 12.0 beta out in Apple (Mac) Discussion & Support 


Greedy music execs at it again in Back Page News 


The Big Wrestling Thread! in The Sporting Arena 


Routing LAN to VLANtagged WAN and lease options. in Internet, Network & Security 


The 39 things I have learned in 39 years on this earth in Milestones and Achievements 

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); }