首先打一个小表,然后oeis得到一个数列,所以按照数列判断是不是质数即可.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
#include<bits/stdc++.h>
using namespace std;
#define enter fout<<"\n";
#define space fout<<" ";
#define dot fout<<",";
#define oui fout<<"Yes\n";
#define non fout<<"No\n";
#define si fout<<"?";
#define i32 int
#define u32 unsigned int
#define i64 long long
#define u64 unsigned long long
#define i128 __int128
#define u128 unsigned __int128
#define debug(x) fout<<#x<<"="<<x<<"\n";
#define vdebug(a,n) fout<<#a<<"=[";for(int i=0;i<=n;++i)fout<<a[i]<<" ";fout<<"]\n";
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
namespace fastio{
const int bufl=1<<20;
const double base1[16]={1,1e-1,1e-2,1e-3,1e-4,1e-5,1e-6,1e-7,1e-8,1e-9,1e-10,1e-11,1e-12,1e-13,1e-14,1e-15};
const double base2[16]={1,1e1,1e2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15};
struct IN{
FILE *IT;char ibuf[bufl],*is=ibuf,*it=ibuf;
IN(){IT=stdin;}IN(char *a){IT=fopen(a,"r");}
inline char getChar(){if(is==it){it=(is=ibuf)+fread(ibuf,1,bufl,IT);if(is==it)return EOF;}return *is++;}
template<typename Temp>inline void getInt(Temp &a){a=0;int b=0,c=getChar();while(c<48||c>57)b^=(c==45),c=getChar();while(c>=48&&c<=57)a=(a<<1)+(a<<3)+c-48,c=getChar();if(b)a=-a;}
template<typename Temp>inline void getDouble(Temp &a){a=0;int b=0,c=getChar(),d=0;__int128 e=0,f=0;while(c<48||c>57)b^=(c==45),c=getChar();while(c>=48&&c<=57)e=(e<<1)+(e<<3)+c-48,c=getChar();if(c==46){c=getChar();while(c>=48&&c<=57)d++,f=(f<<1)+(f<<3)+c-48,c=getChar();}a=e+base1[d]*f;if(b)a=-a;}
IN& operator>>(char &a){a=getChar();while(a<=32)a=getChar();return *this;}
IN& operator>>(char *a){do{*a=getChar();}while(*a<=32);while(*a>32)*++a=getChar();*a=0;return *this;}
IN& operator>>(string &a){a.clear();char b=getChar();while(b<=32)b=getChar();while(b>32)a+=b,b=getChar();return *this;}
IN& operator>>(int &a){getInt(a);return *this;}
IN& operator>>(long long &a){getInt(a);return *this;}
IN& operator>>(__int128 &a){getInt(a);return *this;}
IN& operator>>(float &a){getDouble(a);return *this;}
IN& operator>>(double &a){getDouble(a);return *this;}
IN& operator>>(long double &a){getDouble(a);return *this;}
};
struct OUT{
FILE *IT;char obuf[bufl],*os=obuf,*ot=obuf+bufl;int Eps;long double Acc;
OUT(){IT=stdout,Eps=6,Acc=0.5;}OUT(char *a){IT=fopen(a,"w"),Eps=6,Acc=0.5;}
inline void ChangEps(int x=6){Eps=x;}
inline void flush(){fwrite(obuf,1,os-obuf,IT);os=obuf;}
inline void putChar(int a){*os++=a;if(os==ot)flush();}
template<typename Temp>inline void putInt(Temp a){if(a<0){putChar(45);a=-a;}if(a<10){putChar(a+48);return;}putInt(a/10);putChar(a%10+48);}
template<typename Temp>inline void putLeading(Temp a,int b){if(!b)return;putLeading(a/10,b-1);putChar(a%10+48);}
template<typename Temp>inline void putDouble(Temp a){if(a<0){putChar(45);a=-a;}__int128 ff=(a-(__int128)a)*base2[Eps+2],gg=0;ff+=50;while(ff>0){ff/=10;gg++;}__int128 b=a;if(gg==Eps+3){putInt(b+1);}else{putInt(b);}a-=b;a*=base2[Eps];b=a+Acc;putChar(46);putLeading(b,Eps);}
OUT& operator<<(char a){putChar(a);return *this;}
OUT& operator<<(const char *a){while(*a)putChar(*a++);return *this;}
OUT& operator<<(string a){for(auto c:a)putChar(c);return *this;}
OUT& operator<<(int a){putInt(a);return *this;}
OUT& operator<<(long long a){putInt(a);return *this;}
OUT& operator<<(__int128 a){putInt(a);return *this;}
OUT& operator<<(unsigned int a){putInt(a);return *this;}
OUT& operator<<(unsigned long long a){putInt(a);return *this;}
OUT& operator<<(unsigned __int128 a){putInt(a);return *this;}
OUT& operator<<(float a){putDouble(a);return *this;}
OUT& operator<<(double a){putDouble(a);return *this;}
OUT& operator<<(long double a){putDouble(a);return *this;}
~OUT(){flush();}
};
}
fastio::IN fin;
fastio::OUT fout;



int vis[1000010];//存最小质因数,负的表示质数表中的位置(负的)
int p[100010],ptop=0;//存质数
short mu[1000010];//莫比乌斯函数
int musu[1000010];//梅滕斯函数,莫比乌斯前缀和
int phi[1000010];//欧拉函数
long long phisu[1000010];//欧拉函数前缀和
int d[1000010];//存每个数的约数个数
int mnnum[1000010];//最小质因子出现次数
void sieve(int n){//[1,n]
phi[1]=1;phisu[1]=1;mu[1]=1;musu[1]=1;d[1]=1;
int tmp;
for(int i=2;i<=n;++i){
if(!vis[i]){
vis[i]=-(++ptop);
p[ptop]=i;
mu[i]=-1;//
phi[i]=i-1;//
d[i]=2;//
mnnum[i]=1;//
}
for(int j=1;j<=ptop&&i*p[j]<=n;++j){
vis[i*p[j]]=p[j];
if(i%p[j]==0){
phi[i*p[j]]=phi[i]*p[j];//
mnnum[i*p[j]]=mnnum[i]+1;//
d[i*p[j]]=d[i]/mnnum[i*p[j]]*(mnnum[i*p[j]]+1);//
break;
}else{
mu[i*p[j]]=-mu[i];//
phi[i*p[j]]=phi[i]*(p[j]-1);//
mnnum[i*p[j]]=1;//
d[i*p[j]]=d[i]*2;//
}
}
musu[i]=musu[i-1]+mu[i];//
phisu[i]=phisu[i-1]+phi[i];//
}
}

namespace decompos{
unsigned long long Number(unsigned long long a,unsigned long long b){
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
return (a+rng()%(b-a+1));
}
unsigned long long stein(unsigned long long x,unsigned long long y){
if(x==y)return x;
unsigned long long a=y-x;
unsigned long long b=x-y;
int n=__builtin_ctzll(b);
unsigned long long s=(x<y?a:b);
unsigned long long t=(x<y?x:y);
return stein(s>>n,t);
}
unsigned long long gcd(unsigned long long x,unsigned long long y){
if(x==0)return y;
if(y==0)return x;
int n=__builtin_ctzll(x);
int m=__builtin_ctzll(y);
return (stein(x>>n,y>>m)<<(n<m?n:m));
}
unsigned long long limit=2147483648;
vector<int>small={2,7,61};
vector<int>large={2,325,9375,28178,450775,9780504,1795265022};
unsigned long long qp(unsigned long long x,unsigned long long y,unsigned long long m){
unsigned long long res=1;
while(y){
if(y&1)res=((unsigned __int128)res*x)%m;
x=((unsigned __int128)x*x)%m;
y>>=1;
}
return res;
}
bool isComposite(unsigned long long a,unsigned long long d,unsigned long long n,unsigned long long s){
unsigned long long x=qp(a,d,n);
if(x==1)return false;
while(s--){
if(x==n-1)return false;
x=((unsigned __int128)x*x)%n;
}
return true;
}
bool isPrime(unsigned long long n){
if(n==1)
return false;
vector<int>bases=(n<limit?small:large);
if(find(bases.begin(),bases.end(),n)!=bases.end())
return true;
for(int p:bases)
if(n%p==0)
return false;
unsigned long long s=__builtin_ctzll(n-1);
unsigned long long d=(n-1)>>s;
for(int base:bases){
if(isComposite(base,d,n,s))
return false;
}
return true;
}
class Montgomery{
unsigned long long m;
unsigned long long r;
public:
Montgomery(unsigned long long n):m(n),r(n){
for(int i=0;i<5;i++){
r*=2-m*r;
}
}
unsigned long long fma(unsigned long long a,unsigned long long b,unsigned long long c)const{
unsigned __int128 d=(unsigned __int128)(a)*b;
unsigned long long e=c+m+(d>>64);
unsigned long long f=(unsigned long long)(d)*r;
unsigned long long g=((unsigned __int128)(f)*m)>>64;
return (e-g);
}
unsigned long long mul(unsigned long long a,unsigned long long b)const{return fma(a,b,0);}
};
unsigned long long PollardRho(unsigned long long n){
if(n%2==0)return 2;
Montgomery m(n);
unsigned long long c1=1;
unsigned long long c2=2;
unsigned long long M=512;
unsigned long long w1=1;
unsigned long long w2=2;
retry:
unsigned long long z1=w1;
unsigned long long z2=w2;
for(unsigned long long k=M;;k <<= 1){
unsigned long long x1=z1+n;
unsigned long long x2=z2+n;
for(unsigned long long j=0;j<k;j+=M){
unsigned long long y1=z1;
unsigned long long y2=z2;
unsigned long long q1=1;
unsigned long long q2=2;
z1=m.fma(z1,z1,c1);
z2=m.fma(z2,z2,c2);
for(unsigned long long i=0;i<M;i++){
unsigned long long t1=x1-z1;
unsigned long long t2=x2-z2;
z1=m.fma(z1,z1,c1);
z2=m.fma(z2,z2,c2);
q1=m.mul(q1,t1);
q2=m.mul(q2,t2);
}
q1=m.mul(q1,x1-z1);
q2=m.mul(q2,x2-z2);
unsigned long long q3=m.mul(q1,q2);
unsigned long long g3=gcd(n,q3);
if(g3==1)continue;
if(g3!=n)return g3;
unsigned long long g1=gcd(n,q1);
unsigned long long g2=gcd(n,q2);
unsigned long long c=(g1!=1?c1:c2);
unsigned long long x=(g1!=1?x1:x2);
unsigned long long z=(g1!=1?y1:y2);
unsigned long long g=(g1!=1?g1:g2);
if(g==n){
do{
z=m.fma(z,z,c);
g=gcd(n,x-z);
}while(g==1);
}
if(g!=n)return g;
w1+=2;
w2+=2;
goto retry;
}
}
}
void factorize(unsigned long long n,vector<unsigned long long>& res){
if(n<=1)return;
if(isPrime(n)){
res.push_back(n);
return;
}
unsigned long long p=PollardRho(n);
factorize(p,res);
factorize(n/p,res);
}
}




long long n,m,res;
//#define NaraFluorine
int main(){
sieve(1000);
for(i64 x=1;x<=1000;++x){
for(i64 y=1;y<=1000;++y){
i64 upper=x*x*x*x-y*y*y*y;
i64 lower=x*x*x+y*y*y;
if((upper)%(lower)==0&&(upper/lower)>=1&&vis[upper/lower]<=0){
fout<<"! "<<(upper/lower)<<" "<<x<<" "<<y<<"\n";
}
}
}
i64 inf=5e15;
for(i64 x=1;;++x){
i64 tmp=x*x+(x+1)*(x+1);
if(tmp>inf)break;
else{
if(decompos::isPrime(tmp)){
res++;
// fout<<"$ "<<tmp<<" "<<x<<" "<<x+1<<"\n";
}
}
if(x%100000==0){
fout<<"! "<<x<<" "<<res<<"\n";
fout.flush();
}
// if(tmp<=1000){
// if(vis[tmp]<=0){
// fout<<"# "<<tmp<<" "<<x<<" "<<x+1<<"\n";
// }
// }else break;
// fout<<tmp<<"\n";
}
fout<<res;
return 0;
}