Morgan Stanley interview question

function to calc prime number