def prime?(n) ("1" * n) !~ /^1?$|^(11+?)\1+$/ end