Thread Syntax highlighting (15 answers)
Opened by LanX at 2009-03-02 13:47

Gast LanX
 2009-03-02 18:41
#57 #57
mit code=perl klappts auch mit der Buntwäsche ; )

Guest Taulmarill
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use strict;
use warnings;

my @primes = qw/2 3 5 7/;

for my $i ( 10 .. 1_000_000 ) {
    for my $j ( @primes ) {
        if ( $j > sqrt $i ) {
            push @primes, $i;
            last;
        }
        next if $i % $j;
        last unless $i % $j;
    }
}

print "$_\n" for @primes;


Hier sollten dann auch die Zeilennummern Sinn machen.

View full thread Syntax highlighting