Loading

筛出质因子

void get_prime(ll x) { ///筛出质因子
    ll t=x;
    if(x%2==0) {
        v.push_back(2);
        while(x%2==0) x/=2;
    }
    for(ll i=3;i*i<=t;i+=2) {
        if(x%i==0) v.push_back(i);
        while(x%i==0) x/=i;
    }
    if(x>2) v.push_back(x);
}

 

posted @ 2019-10-01 22:27  qinuna  阅读(115)  评论(0编辑  收藏  举报