This question is asked in a programming contest. I couldn't find any way other than generating all permutations. But the number of digits is upto 15 and no of permutations (15!) is very large. Is there any other way?
I know that if (5*N^2 + 4) or (5*N^2 - 4) is a perfect square, n is fibonacci.