专属质数

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

#include
#include
#include
#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;
}

转载于:https://www.cnblogs.com/Point-King/p/9894620.html

你可能感兴趣的:(专属质数)