Prime Generator Solution