Check out this PrePrint, it describes fast and simple algorithms for checking primality:
https://www.researchgate.net/publication/387736343_Fast_Novel_Deterministic_Algorithm_for_Checking_Primality_Determining_if_a_number_is_a_Prime_Number