#include <stdio.h>
#include <math.h>
#include<bits/stdc++.h>
using namespace std;
#define SIZE 33001
long long int status[SIZE],ar[10000]={0},k=0;;
void sieve()
{
long long int i,j;
for(i=0;i<SIZE;i++) status[i]= 0;
int sq = sqrt(SIZE);
for(i=4;i<=SIZE;i+=2) status[i] = 1;
for(i=3;i<=sq;i+=2)
{
if(status[i]==0)
{
for(j=2*i;j<=SIZE;j+=i)
status[j]=1;
}
}
status[1] = 1;
status[0] = 1;
for(i=0;i<=SIZE;i++)
{
if(status[i]==0)
{
ar[k]=i;
k++;
}
}
}
int main()
{
long long int n,i2;
map<long long,long long>mp;
sieve();
long long a,b;
while(cin>>a>>b)
{
long long i1,flag=0,i2,k1=0,diff=0,diff1=0,cnt=0,visit[32000]={0};
if(a>b)
swap(a,b);
if(a==0&&b==0)
{
break;
}
else
{
i2=0;
for(i1=0;i1<k;i1=i2+1)
{
i2=i1;
if(ar[i1]<a)
continue;
if(ar[i1]>b)
break;
else
{
if(ar[i1+1]<=b)
{
diff=ar[i1+1]-ar[i1];
if(ar[i1]-ar[i1-1]==diff)
{
//i2=i1+1;
continue;
}
else
{
if(ar[i1+2]<=b)
{
if(diff==(ar[i1+2]-ar[i1+1]))
{
if(ar[i1+3]>b)
{
if(diff==(ar[i1]-ar[i1-1]))
continue;
else if(diff==(ar[i1+3]-ar[i1+2]))
continue;
else
{
cnt++;
cout<<ar[i1]<<" "<<ar[i1+1]<<" "<<ar[i1+2]<<endl;
}
}
else
{
if(diff==(ar[i1+3]-ar[i1+2]))
{
cnt++;
cout<<ar[i1]<<" "<<ar[i1+1]<<" "<<ar[i1+2]<<" "<<ar[i1+3]<<endl;
}
else if(diff==(ar[i1]-ar[i1-1]))
continue;
else
{
cnt++;
cout<<ar[i1]<<" "<<ar[i1+1]<<" "<<ar[i1+2]<<endl;
}
}
}
else
continue;
}
}
}
else
break;
}
}
}
}
}
#include <math.h>
#include<bits/stdc++.h>
using namespace std;
#define SIZE 33001
long long int status[SIZE],ar[10000]={0},k=0;;
void sieve()
{
long long int i,j;
for(i=0;i<SIZE;i++) status[i]= 0;
int sq = sqrt(SIZE);
for(i=4;i<=SIZE;i+=2) status[i] = 1;
for(i=3;i<=sq;i+=2)
{
if(status[i]==0)
{
for(j=2*i;j<=SIZE;j+=i)
status[j]=1;
}
}
status[1] = 1;
status[0] = 1;
for(i=0;i<=SIZE;i++)
{
if(status[i]==0)
{
ar[k]=i;
k++;
}
}
}
int main()
{
long long int n,i2;
map<long long,long long>mp;
sieve();
long long a,b;
while(cin>>a>>b)
{
long long i1,flag=0,i2,k1=0,diff=0,diff1=0,cnt=0,visit[32000]={0};
if(a>b)
swap(a,b);
if(a==0&&b==0)
{
break;
}
else
{
i2=0;
for(i1=0;i1<k;i1=i2+1)
{
i2=i1;
if(ar[i1]<a)
continue;
if(ar[i1]>b)
break;
else
{
if(ar[i1+1]<=b)
{
diff=ar[i1+1]-ar[i1];
if(ar[i1]-ar[i1-1]==diff)
{
//i2=i1+1;
continue;
}
else
{
if(ar[i1+2]<=b)
{
if(diff==(ar[i1+2]-ar[i1+1]))
{
if(ar[i1+3]>b)
{
if(diff==(ar[i1]-ar[i1-1]))
continue;
else if(diff==(ar[i1+3]-ar[i1+2]))
continue;
else
{
cnt++;
cout<<ar[i1]<<" "<<ar[i1+1]<<" "<<ar[i1+2]<<endl;
}
}
else
{
if(diff==(ar[i1+3]-ar[i1+2]))
{
cnt++;
cout<<ar[i1]<<" "<<ar[i1+1]<<" "<<ar[i1+2]<<" "<<ar[i1+3]<<endl;
}
else if(diff==(ar[i1]-ar[i1-1]))
continue;
else
{
cnt++;
cout<<ar[i1]<<" "<<ar[i1+1]<<" "<<ar[i1+2]<<endl;
}
}
}
else
continue;
}
}
}
else
break;
}
}
}
}
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন