algorithm - Working through nested loops -
is there way find primes between 0 100 without using nested loops, i.e. time complexity of less n^2. did try recursion still same same complexity. can please. thanks
a useful implementation pre-calculate list.
my @primes = ( 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, ); @primes;
obvious? maybe, bet many people post far more complex, , slower solutions.
Comments
Post a Comment