Find the lowest positive integer that has its digits reversed after dividing it by 2.
After trying to work it out arithmetically by the possible first/last digit combinations, I found nothing.
I decided to try to find one, anyway, just for the heck of it. The following javascript found nothing:
<script>
function reverse(x) {
xstr = x.toString();
str = "";
for (var d = xstr.length; d >= 0; --d)
{
str += xstr.charAt(d);
}
return str;
}
function doPal(x) {
double = 2*x;
if (double == reverse(x)) {
document.write(x + " " + double + "<br>");
return true;
}
return false;
}
for (var i = 1; i < 10000000; i++)
doPal(i);
</script>
|
Posted by DJ
on 2004-07-15 17:45:21 |