h

#include<iostream>
#include<cstdio>
#include<cstring>
#define N 1000005
using namespace std;
int position[N];
int main()
{
  memset(position,0,sizeof(position));
  position[1]=0;
  int next=1;
  int i,j;
  for(i=2;i<N;i++)
  {
    if(position[i])
    continue;
    for(j=i;j<N;j+=i)
    {
      position[j]=next;
    }
    next++;
  }
  int m;
  while(scanf("%d",&m)!=EOF)
  {
    printf("%d\n",position[m]);
  }
}
posted @ 2012-04-28 21:54  剑不飞  阅读(423)  评论(0编辑  收藏  举报