Advertisement
Guest User

Untitled

a guest
Sep 13th, 2011
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. sub is_prime {
  2. my @x = (`factor $_[0]` =~ / /g);
  3. return @x == 1;
  4. }
  5.  
  6. for my $n (8 .. 1000000) {
  7. next if $n % 2;
  8.  
  9. my $found = 0;
  10. for my $p (3 .. $n) {
  11. next unless $p % 2;
  12. my $q = $n - $p;
  13. next unless $q % 2;
  14. next unless is_prime($p);
  15. next unless is_prime($q);
  16. next unless is_prime(($p - 1) / 2) || is_prime(($q - 1) / 2);
  17. $found = 1;
  18. last;
  19. }
  20.  
  21. print "$n\n" unless $found;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement