跳到正文

剪贴板

剪贴板 xp7fbdyx

原文
剪贴板信息

剪贴板信息

收录
更新

p=r×2k+1p=r\times 2^k+1 的较小的 2k2^k 次单位根:

rrkkpp较小单位根(≤100\leq 100)最小单位根
119119232399824435399824435331,8931,893131
479479212110045358091004535809无41724172
77262646976204946976204930,33,54,57,58,67,68,83,9630,33,54,57,58,67,68,83,963030
55252516777216116777216117,34,43,68,71,85,8617,34,43,68,71,85,861717

爆搜程序:

C++
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long long int li;
typedef pair<ll,ll> pii;
const ll MAXN=2e5+51;
pii res;
mt19937 mt(time(0));
ll r,x,p;
inline ll read()
{
    register ll num=0,neg=1;
    register char ch=getchar();
    while(!isdigit(ch)&&ch!='-')
    {
        ch=getchar();
    }
    if(ch=='-')
    {
        neg=-1;
        ch=getchar();
    }
    while(isdigit(ch))
    {
        num=(num<<3)+(num<<1)+(ch-'0');
        ch=getchar();
    }
    return num*neg;
}
template <class T>
inline T Min(T x,T y)
{
	return x<y?x:y;
}
template <class T>
inline T Max(T x,T y)
{
	return x>y?x:y;
}
inline ll rd()
{
    return mt()%p;
}
inline ll qpow(ll base,ll exponent)
{
    li res=1;
    while(exponent)
    {
        if(exponent&1)
        {
            res=(li)res*base%p;
        }
        base=(li)base*base%p,exponent>>=1;
    }
    return res;
}
inline bool chkx(ll num)
{
    return qpow(num,(p-1)>>1)==p-1;
}
inline pii mul(pii x,pii y,ll k)
{
    ll x1=x.first,x2=x.second,y1=y.first,y2=y.second;
    ll res1=((li)x1*y1%p+(li)x2*y2%p*k%p)%p;
    ll res2=((li)x2*y1%p+(li)x1*y2%p)%p;
    return make_pair(res1,res2);
}
inline pii Cipolla(ll num)
{
    if(chkx(num))
    {
        return make_pair(-1,-1);
    }
    ll k,kk,exponent;
    while(1)
    {
        k=rd(),kk=(((li)k*k%p-num)%p+p)%p;
        if(chkx(kk))
        {
        	break;
		}
    }
    exponent=(p+1)>>1;
    pii res=make_pair(1,0),base=make_pair(k,1);
    while(exponent)
    {
        if(exponent&1)
        {
            res=mul(res,base,kk);
        }
        base=mul(base,base,kk),exponent>>=1;
    }
    return make_pair(Min(res.first,p-res.first),Max(res.first,p-res.first));
}
inline void dfs(ll cur,ll depth)
{
	pii pr;
	if(depth==x-1)
	{
		if(cur<100)
		{
			cout<<cur<<endl;
		}
		return;
	}
	pr=Cipolla(cur),dfs(pr.first,depth+1),dfs(pr.second,depth+1);
}
int main()
{
	r=read(),x=read(),p=r*(1<<x)+1,cout<<p<<endl,dfs(p-1,0);
}