专属质数

$2693$
$44533$
$309007$
$7710343$
$55426561$
$991664501$

#include<cstdio>
#include<cstdlib>
#include<ctime>
#define int long long
bool cmp(int x)
{
    for(int i=2;i*i<=x;++i)
    {
        if(x%i==0)
        return false;
    }
    return true;
}
int count(int x)
{
    int k=0;
    while(x>0)
    {
        x/=10;
        ++k;
    }
    return k;
}
signed main()
{
    srand(time(NULL));
    while(1)
    {
        int i=(rand()*rand())%(rand()*rand())+rand();
        if(cmp(i)==true&&count(i)==6)
        {
            printf("%lld\n",i);
            return 0;
        }
    }
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/Point-King/p/9894620.html