You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
286 B

#include<bits/stdc++.h>
using namespace std;
const int MAXN=10001;
int main() {
int a[MAXN];
int n,k;
int i,j;
memset(a,0,sizeof(a));
cin>>n>>k;
for(i=2; i<=k; i++)
for(j=1; j<=n; j++)
if(j%i==0) a[j]=!a[j];
for(i=1; i<=n; i++)
if(!a[i])
cout<<i<<" ";
return 0;
}