Trying to figure out prime function