Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
618 B
7
Indexable
Never
#include <stdio.h>
#include <math.h>
int main()
{
    int n,counter=0;
    scanf("%d",&n);
    for (int i =1; i <= n; i++)
    {
        if (counter==5)
        {
            break;
        }
       
        int flag=0;
        if (i==1)
        {
            flag=1;
        }
        for (int j = 2; j <=i/2; j++)
        {
            if (i%j==0)
            {
                flag=1;
                break;
            }
        }  
        if (flag==0)
        {
            int k=pow(2,i);
            printf("%d\n",k-1);
            counter++;
        }
    }
    return 0;
}