28.08.2012, 19:40
Interesting question..
Think like a computer!
This script I just wrote can find such numbers (if exisiting).
Note that its just functional to do what you need, no eye given to speed
This does not return any result except 0 for the first million numbers.
Explanation why such a number cant exist is following as soon as I made up my mind
Think like a computer!
This script I just wrote can find such numbers (if exisiting).
Note that its just functional to do what you need, no eye given to speed
pawn Код:
stock findRev(min, max)
{
for (new i = min; i <= max; i++) {
if (reverseNumber(i) == 2 * i) printf("%d is a reverse-magic number!", i);
}
}
stock reverseNumber(num)
{
new t[12], n[12];
format(t, 12, "%d", num);
new slen = strlen(t);
for (new i = 0; i < slen; i++) {
n[slen - i - 1] = t[i];
}
return strval(n);
}
Explanation why such a number cant exist is following as soon as I made up my mind