Revision c5a6c6cd-7d60-4335-a86c-94e5852ce3da - Code Golf Stack Exchange
# [Perl 6], 36 - 50 = -14 points
<!-- language-all: lang-perl6 -->
{$^a;first {/$a/&&$_%%one ^$_},2..*}
[Try it online!][TIO-jqony5k6]
[Perl 6]: https://github.com/nxadm/rakudo-pkg
[TIO-jqony5k6]: https://tio.run/##RYtLC4JAFEb38ysuwyiaOr7IEklq0a5ltPGFixEEU/HaIsTfPk1FdFfncL8ziqmL5P0JegMHkAsr66RpJ5xhcVnt6jqrNG3oBZSsWu2A880qHyjgKnBOCFHhcVaIKja6thdopinHsWtnw83Ryp08zdE11XTs6h6s71ppM0y/dCEALUJj8Mwr@Pl2upg2z/yCrJL6HgV1Tgq@5xPqhX8NCQ2CgH5VkXrH@120pW//UPwC "Perl 6 – Try It Online"
Considering `$_%%one ^$_` is the only 2 bytes smaller than `.is-prime`, I think it's worth it for the bonus. This times out for the last test case.
### Explanation:
{ } # Anonymous code block
$^a; # Assign input to $a
first ,2..* # Find the first number
{ } # Which
/$a/ # Contains the input
&& # And
$_%%one ^$_ # Is prime