voidInitPTable(){ for (int i = 2; i <= MAXN; ++i) { if (IsPrime[i] == false) { PTable.push_back(i); for (int j = 2 * i; j <= MAXN; j += i) { IsPrime[j] = true; } } } }
voidInitPresum(){ sum[1] = PTable[0]; for (int i = 2; i <= 1229; ++i) { sum[i] = sum[i - 1] + PTable[i - 1]; } }
intmain(){ InitPTable(); InitPresum(); int n; while (cin >> n && n) { int Ans = 0; for (int i =1; i < 1229; ++i) { for (int j = 0; j < i; ++j) { Ans += (sum[i] - sum[j] == n); } } printf("%d\n", Ans); } return0;