Base on:
How on Earth does ^.?$|^(..+?)\1+$ produce primes?
Introduction
import re
n = 13 # an integer to test
x = re.match(r'^.?$|^(..+?)\1+$','1'*n)
if x is None:
print()
print(f'{n} is a prime number')
else:
print()
print(f'{n} is not a prime number')
Project #1
Create and interactive program:
- asks the users to input a positive integer
- test if the integer is a prime number
- display the integer
- display if it is a prime or not
- loop
Note: set reasonable limits on the input integer.
Project #2
Convert Project #1 into a GUI.