improved algorithm

added option to only show last prime