PERL 53 54 52 48
('a'x($_=pop))=~/^a?$|^(?<a>aa+?)\g{a}+$/||print
Thanks to reddit: http://www.reddit.com/r/programming/comments/crmhe/regular_expression_to_check_for_prime_numbers_1111/
('a'x($_=pop))=~/^a?$|^(?<a>aa+?)\g{a}+$/||print
Thanks to reddit: http://www.reddit.com/r/programming/comments/crmhe/regular_expression_to_check_for_prime_numbers_1111/