#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
long long n;
int t=1;
while(~scanf("%lld",&n)&&n)
{
long long x=n,res=0,len=(long long)sqrt(n);
int cnt=0;
for(long long i=2;i<=len&&x>1;i++)
{
if(x%i==0)
{
cnt++;
long long int t=1;
while(x%i==0&&x>1)
{
t*=i;
x/=i;
}
res+=t;
}
}
if(x>1)
{
res+=x;
cnt++;
}
if(cnt<2)
printf("Case %d: %lld\n",t++,n+1);
else
printf("Case %d: %lld\n",t++,res);
}
}
uva 10791 和最小的LCM
最新推荐文章于 2017-09-07 10:52:42 发布