Palindrome pointlessness

Benchmark created on


Setup

a=999; x=0;
    
    var solution = [];
    var maxresult = 0;

Test runner

Ready to run.

Testing in
TestOps/sec
Phil
for(a;a>0;a--){
for(b=a;b>0;b--){
 y=a*b;
 c=(y+"").split('');
 d=c.length;
 if(d%2){c.splice(d/2,1);d--}
 while(d>0){
  t=(c[0]===c[d-1]);c=(t)?c.slice(1,d-1):[];
  if(t&&d==2&&x<y)x=y;
  d=c.length}
}}
ready
Zac
for (var x=999; x > 0; x--)
{
    for (var y=999; y > 0; y--)
    {
        var r = x * y;
        if (r > maxresult && win(x,y))
        {
            maxresult = r;
            solution = [x,y];
        }
    }
}

function win(x,y)
{
    var resultString = (x * y).toString();
    for (var i = 0; i < resultString.length / 2; i++)
    {
        if (resultString[i] != resultString[resultString.length-i-1])
            return false;
    }
    return true;
}
ready
Phil take 2
 
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.