Completed prime and defix functions