#include<bits/stdc++.h>
using namespace std;
#define N 1000000
int p[N+1];
vector<int>a;
void prime()
{
int i, j, l;
l = sqrt(N);
p[0] = p[1] = 1;
a.push_back(2);
for(i=4;i<=N;i+=2)
p[i] = 1;
for(i=3;i<=N;i+=2)
{
if(p[i] == 0)
{
a.push_back(i);
if(i<=l)
{
for(j=i*i;j<=N;j+=i*2)
p[j] = 1;
}
}
}
}
int main()
{
prime();
long int n, m, i, j, c;
while(cin >> m)
{
if(m == 0)
break;
c = 0;
n = m;
for(i=0;a[i]<=n && n > 1; i++)
{
if(n%a[i] == 0 && p[n] == 0 && n == a[i])
{
c++;
break;
}
else if(n % a[i] == 0)
{
c++;
while(n %a[i] == 0)
{
n = n/a[i];
}
}
}
cout << m << " : " << c << endl;
}
return 0;
}
using namespace std;
#define N 1000000
int p[N+1];
vector<int>a;
void prime()
{
int i, j, l;
l = sqrt(N);
p[0] = p[1] = 1;
a.push_back(2);
for(i=4;i<=N;i+=2)
p[i] = 1;
for(i=3;i<=N;i+=2)
{
if(p[i] == 0)
{
a.push_back(i);
if(i<=l)
{
for(j=i*i;j<=N;j+=i*2)
p[j] = 1;
}
}
}
}
int main()
{
prime();
long int n, m, i, j, c;
while(cin >> m)
{
if(m == 0)
break;
c = 0;
n = m;
for(i=0;a[i]<=n && n > 1; i++)
{
if(n%a[i] == 0 && p[n] == 0 && n == a[i])
{
c++;
break;
}
else if(n % a[i] == 0)
{
c++;
while(n %a[i] == 0)
{
n = n/a[i];
}
}
}
cout << m << " : " << c << endl;
}
return 0;
}
Comments
Post a Comment