Zelaron Gaming Forum

Zelaron Gaming Forum (http://zelaron.com/forum/index.php)
-   Principia Mathematica (http://zelaron.com/forum/forumdisplay.php?f=385)
-   -   Weird prime tests (http://zelaron.com/forum/showthread.php?t=62014)

Chruser 2024-12-24 07:39 PM

Weird prime tests
 
What's your strangest way to check if a number is prime? Here's a Python one using regex:

Code:

import re
def is_prime(n):
    return not re.match(r"^.?$|^(..+?)\1+$","\0"*n)


WetWired 2024-12-30 09:21 AM

I find it hard to believe that a regex could identify primeness. My recollection is that encryption keys are usually not exhaustively proven but only proven “likely prime”


All times are GMT -6. The time now is 04:00 AM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.