Chruser
2024-12-24, 07:39 PM
What's your strangest way to check if a number is prime? Here's a Python one using regex:
import re
def is_prime(n):
return not re.match(r"^.?$|^(..+?)\1+$","\0"*n)
import re
def is_prime(n):
return not re.match(r"^.?$|^(..+?)\1+$","\0"*n)