This problem is in Contest(s) below:
Contest 1058:1106、1113少年宫三、四
Contest 1057:质数系列1
Contest 1128:练习0907 NHOI2013小甲
Contest 1215:质数系列1
Contest 1056:1106少年宫二
Contest 1000:夏令营0717