Fixed prime function