check prime function separated, code modified