verified code with comments for NumberGreaterByNByKTimes'