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
Xbox One screenshot feature coming next year; holidays will see smaller updates in Front Page News 


Sunset Overdrive [Day One Ed. & First Gameplay Vid] in Microsoft Console 


Answered LED Television Grey Orb in Hardware Hangout 


COD: Advanced Warfare in Gamers' Hangout 


PC Upgrade  Limited budget in Hardware Hangout 

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