Skip to content

Instantly share code, notes, and snippets.

@moritz
Created April 13, 2012 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moritz/2376843 to your computer and use it in GitHub Desktop.
Save moritz/2376843 to your computer and use it in GitHub Desktop.
find the first 7-digit palindromic substring of pi that is als a prime
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);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment