# Determine all possible positive palindrome(s) numbers [closed]

Determine all possible positive palindrome(s) N numbers, such that the decimal representation of 2 x N^2 has no leading zeroes and contains each of the digits from 0 to 9 exactly once.

• – boboquack Sep 20 '17 at 6:23
• @boboquack Sorry i was understood programming language. – Smart Sep 20 '17 at 6:31
• wait....is it $(2 \times N)^2$ or $2 \times N^2$ ? yeah yeah, I know the order of operations. I just want to make sure – Marius Sep 20 '17 at 7:09
• @Marius 2 x N^2 – Smart Sep 20 '17 at 7:12

I think they are:

$N = 46464$ and $2 \times N^2= 4317806592$
$N = 69696$ and $2 \times N^2= 9715064832$

Explanation.

The value of $2*N^2$ should be between 1023456789 and 9876543210.
This means that N has to be between $\sqrt{\frac{1023456789}{2}} = 22621.41$ and $\sqrt{\frac{9876543210}{2}} =70272.83$. Since N is integer it means it has to be between 22622 and 70272.
Wrote a little script that loops through all the numbers and checks if the number is a palindrome and that $2*N^2$ contains all the digits.
Here is my code. It can be tested on http://phpfiddle.org/

<?php

function isPalindrome($string) { return$string == strrev($string); } function hasAllDigits($string) {
$string = (string)$string;
if (strlen($string) != 10) { return false; }$digits = [];
for ($i = 0;$i<strlen($string);$i++) {
if (isset($digits[$string[$i]])) { return false; }$digits[$string[$i]] = 1;
}
return true;
}

for ($i = 22622;$i<=70272; $i++) { if (!isPalindrome($i)) {
continue;
}
$x = 2*$i*$i; if (!hasAllDigits($x)) {
continue;
}
echo $i .'--'.$x.'<br />';
}

• What about 46464 and 69696? 2*n^2 seems to return 4317806592 and 9715064832 for me. – numbermaniac Sep 20 '17 at 7:13
• @numbermaniac. Thanks for the heads up. In my defense, I said it's too early and I may have made a mistake in my "software". – Marius Sep 20 '17 at 7:14
• @numbermaniac. Thanks. You are right. I forgot a cast to string. – Marius Sep 20 '17 at 7:22