Test if a given number is a Vampire Number EDIT: In the interest of increasing the complexity, i've added more to the challenge.


  In mathematics, a vampire number (or
  true vampire number) is a composite
  natural number v, with an even number
  of digits n, that can be factored into
  two integers x and y each with n/2
  digits and not both with trailing
  zeroes, where v contains precisely all
  the digits from x and from y, in any
  order, counting multiplicity. x and y
  are called the fangs.


More about Vampire Number

Pseudovampire numbers


  Pseudovampire numbers are similar to
  vampire numbers, except that the fangs
  of an n-digit pseudovampire number
  need not be of length n/2 digits.
  Pseudovampire numbers can have an odd
  number of digits, for example 126 =
  6×21.


Input

Accept Numbers from command line or stdin

Output


"1260 = 21 * 60" (smaller fang first if the number is a Vampire.)
"1261 is not a Vampire Number." (if the number is not a Vampire number)
"126 = 6 * 21". (if the number is a Pseudovampire number)


EDIT: If the number has multiple fangs, display it so.

x = fang1a * fang1b = fang2a * fang2b
Python - 188 chars
 
Doesn't do Pseudovampire numbers
from itertools import*
n=input()
a=[]
for i in map(&quot;&quot;.join,permutations(`n`)):x,y=int(i[::2]),int(i[::-2]);a+=[(x,y)]*(x*y==n)
print n,a and&quot;=%s*%s&quot;%min(a)or&quot;is not a Vampire Number&quot;