Factors of a Mersenne number: Difference between revisions

Content deleted Content added
m →‎{{header|Perl}}: wrong output
Line 929: Line 929:
next if (($q & 7) != 1 && ($q & 7) != 7);
next if (($q & 7) != 1 && ($q & 7) != 7);
next unless is_prime($q);
next unless is_prime($q);
last if $f = mtest($m, $q);
last if $q * $q > $x;
last if $q * $q > $x;
last if $f = mtest($m, $q);
}
}


Line 936: Line 936:
: "M$m = $x is prime\n";
: "M$m = $x is prime\n";
}</lang>output<lang>M2 = 3 is prime
}</lang>output<lang>M2 = 3 is prime
M3 = 7 = 7 × 1
M2 = 3 is prime
M5 = 31 = 31 × 1
M3 = 7 is prime
M5 = 31 is prime
M7 = 127 is prime
M7 = 127 is prime
M11 = 2047 = 23 × 89
M11 = 2047 = 23 × 89
M13 = 8191 is prime
M13 = 8191 is prime
...
...