[ create a new paste ] login | about

Link: http://codepad.org/b82CoYZR    [ raw code | output | fork ]

C++, pasted on Dec 23:
bool is_prime(short int x)
{
	
	for(int i=2;i<x;i++)
		if(x%i==0)
			return false;

	return true;
}

long double largest_prime(short int x)
{
	short int c=1;
	long double z,y;
	y=x;


	while(y<pow(2,128))
	{
		
		for(int i=9;i>=1;i--)
			{
				z=i*pow(10,c)+y;
				
				if(is_prime(z))
					{cout<<z<<endl;
					c++;
					y=z;}
			}
	}

	return y;
}


Output:
1
2
3
In function 'long double largest_prime(short int)':
Line 18: error: call of overloaded 'pow(int, int)' is ambiguous
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: