Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub is_prime {
- my @x = (`factor $_[0]` =~ / /g);
- return @x == 1;
- }
- sub is_semiprime {
- return 0 if int(sqrt($_[0])) ** 2 == $_[0];
- my @x = (`factor $_[0]` =~ / /g);
- return @x == 2;
- }
- for my $n (12 .. 1000000) {
- next if $n % 2;
- my $found = 0;
- for my $p (3 .. $n) {
- next unless $p % 2;
- my $q = $n - $p;
- next unless $q % 2;
- next unless is_prime($p);
- next unless is_semiprime($q);
- $found = 1;
- last;
- }
- print "$n\n" unless $found;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement