Pagini recente » Cod sursa (job #712509) | Cod sursa (job #2190730) | Cod sursa (job #1961159) | Cod sursa (job #2399791) | Cod sursa (job #308622)
Cod sursa(job #308622)
#include <stdio.h>
#define file_in "gfact.in"
#define file_out "gfact.out"
long long p,q;
inline long long power(long long a, long long b)
{
long long x;
if (b==1)
return a;
else
if (b%2==0)
{
x=power(a,b/2);
return (x*x);
}
else
{
x=power(a,b/2);
return ((x*x)*a);
}
}
inline long long solveq()
{
long long i,nr;
nr=1;
i=1;
while(nr%p!=0)
{
i++;
nr*=i;
//i++;
}
return i;
}
int main()
{
int i;
freopen(file_in,"r",stdin);
freopen(file_out,"w",stdout);
scanf("%lld %lld", &p,&q);
//if (q==1)
p=power(p,q);
printf("%lld", solveq());
//}
fclose(stdin);
fclose(stdout);
return 0;
}