aboutsummaryrefslogtreecommitdiff
path: root/challenge-164/deadmarshal/perl/ch-1.pl
blob: 3a0a26900384907c3ae309e0f8518bd8f425c952 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env perl
use strict;
use warnings;

sub is_prime{
  my ($n) = @_;
  if($n <= 1){return 0;}
  foreach(2..sqrt($n)){
    return 0 if $n % $_ == 0;
  }
  return 1;
}

foreach(1..1000){
  print "$_ " if ($_ == reverse $_) && (is_prime($_));
}