A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91
99.
Find the largest palindrome made from the product of two 3-digit numbers.
Find the largest palindrome made from the product of two 3-digit numbers.
#include
ResponderEliminarlong long i,j,m,n;
bool cr[3000000];
int main(){
cr[0]=cr[1]=true;
for(i=2;i<3000000;i++)
if(cr[i]==false)
for(j=i*i;j<3000000;j=j+i)
cr[j]==true;
n=600851475143;
for(i=1;i<3000000;i++)
if(cr[i]==false&&n%i==0){
n=n/i;
m=i;}
printf("%lld %lld",m,n);
}
Ya acabo el semestre u_u nos reuniremos en el periodo intersemestral???
ResponderEliminar