#include using namespace std; int main() { // 素数作成(エラトステネスのふるい) int sosu[10001],furui[10001]; for(int i=1; i<=10000; i++){ furui[i]=1; } furui[1]=0; for(int i=2; i<=10000; i++){ for(int j=2; j<=10000; j++){ if(i*j>10000) break; furui[i*j]=0; } } // 正しく作れているか確認 1000までの素数168個、10000個まで1229個 int ct=0; for(int i=1; i<=10000; i++){ if(furui[i]){ //cout << i << " "; sosu[ct++]=i; } } //cout << endl; //cout << "count:" << ct << endl; //ループ while(1){ int n; cin >> n; if(n==0) break; //cout << endl << "n=" << n << endl; int ct2=0; for(int i=0; i=n) break; } if(sum==n){ //cout << "ok" << ", "; ct2++; }else{ //cout << "ng" << ", "; } } //cout << endl << ct2 << endl; cout << ct2 << endl; } return(0); }