Guest User

Untitled

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