fork download
#include 
#include 
 
int main()
{
    using namespace std ;
 
    //initialize some long ass integers
    long long primeanswer = 1,p = 1,sqrt_of_i;
    //flag for counting a discovery of a factor
    int factorcount = 0;
    //for loop counts down in twos from an odd number i is number to check
    for (long long i=161;i>0; i=i-2)
    {
        //reset factor count flag to zero
        factorcount =0;
        //squaring i means that finding a factor of i wont take as long
        sqrt_of_i = sqrt(i);
        //loop usues p to get numbers fo checking against square of i
        for(long long p=1; p<=sqrt_of_i; p++ )
        {
            //if there is a remainder of 0 when diveded...
            if((i%p)==0)
            {
                //then a factor has been found, the integer is incremented
                factorcount++;
                //if there is more than two factors the we are not dealing with a prime
                if(factorcount>=2)
                    {
                        break;
                    }
            }
 
        }
        //if we found only one factor (1) then we output the prime :D
        if(factorcount<=1)
        {
            primeanswer = i;
               cout<
				
				
				
				
				
				
			
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 47 43 41 37 31 29 23 19 17 13 11 7 5 3 1