completed assignment, check both prime and non-prime as well as mem output