add prime functions from stackoverflow