Try this:
int i,k,n;
long long j,nsq;
for( n = 31623 ; n < 100000 ; ++n )
{
nsq = (long long)n * (long long)n;
j = nsq;
k = 0;
for( i = 0 ; i < 10; ++i )
{
k |= (1 << (j % 10));
j /= 10;
}
if( k == 01777 )
printf("%i %lli\n",n,nsq);
}
It finds 76 answers in the blink of an eye, the first being 32043^2
and the last being 99066^2.
Dave
On Feb 22, 3:17 pm, bittu <[email protected]> wrote:
> How to find a number of 10 digits (non repeated digits) which is a
> perfect square? perfect square examples: 9 (3x3) 16 (4x4) 25(5x) etc.
> Ten digit number example 1,234,567,890
>
> Thanks & Regards
> Shashank
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.