A vampire number is a natural decimal number with an even number of digits,   that can be factored into two integers.

These two factors are called the   fangs,   and must have the following properties:

   they each contain half the number of the decimal digits of the original number
   together they consist of exactly the same decimal digits as the original number
   at most one of them has a trailing zero


An example of a vampire number and its fangs:    1260 : (21, 60) 



Task

 Print the first   25   vampire numbers and their fangs. 
 Check if the following numbers are vampire numbers and,   if so,   print them and their fangs: 
 16758243290880, 24959017348650, 14593825548650 



Note that a vampire number can have more than one pair of fangs.



See also

 numberphile.com.
 vampire search algorithm
 vampire numbers on OEIS


procedure main()
    write("First 25 vampire numbers and their fangs:")
    every fangs := vampire(n := seq())\25 do write(right(n,20),":",fangs)
    write("\nOther numbers:")
    every n := 16758243290880 | 24959017348650 | 14593825548650 do
        write(right(n,20),": ",vampire(n)|"toothless")
end
 
procedure vampire(n)
    ns := string(n)
    if *ns % 2 = 1 then fail
    every (fangs := "") ||:= " "||fangCheck(n, *ns/2, f1 := 2 to integer(sqrt(n)), n/f1)
    if *fangs > 0 then return fangs
end
 
procedure fangCheck(n, n2, f1, f2)
    if f1*f2 ~= n then fail
    if n2 ~= *(f1|f2) then fail
    if (f1|f2) % 10 ~= 0 then
         if csort(f1||f2) == csort(n) then return "("||f1||","||f2||")"
end
 
procedure csort(s)  # Adapted from csort(s) in Icon IPL
    every (s1 := "", c := !cset(s)) do every find(c, s) do s1 ||:= c
    return s1
end