Dup Goto 📝

Regex To Detect Composite Numbers

PT2/lang/regex python regex prime 11-22 11:23:26
To Pop
5 lines, 31 words, 188 chars Wednesday 2023-11-22 11:23:26

This regular expression (in Python) detects strings of 1's whose length is composite. So strings of all 1's that do not match are prime in length.

r = re.compile(r"^(11+)(\1+)$")