public
Created

find the first 7-digit palindromic substring of pi that is als a prime

  • Download Gist
palindromic-pi-prime.pl
Perl
1 2 3 4 5
use 5.014;
use Math::Prime::XS qw/is_prime/;
while (qx/pi 100000/ =~ /.(?=((\d)(\d)(\d).\4\3\2))/g) {
say $1 if is_prime($1);
};

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.