|Just another Perl shrine|
Vampire Numbersby YuckFoo (Abbot)
|on Jun 10, 2002 at 19:25 UTC||Need Help??|
More recreational math here. Again I was reading some book by Clifford Pickover, and heard about Vampire Numbers.
A Vampire Number is equal to a product of it's digits like 1435 = 41 * 35. I think the name comes from a reference to such a number in an Anne Rice novel.
So I went hunting for more vamps. This program only looks for products of two factors, it would be interesting to look for products of more than two factors.
Algorithm is basically to generate a list of orderings of the digits (1234, 1243, 1342, 1324, ...), not taking the trouble to eliminate duplicates.
Next each ordering is split at each digit and tested (1*234, 12*34, 123*4).
Of note is 153. In addition to being a Triangle Number (1+2+3+...+17), it is also a self-cube-referential number (1**3 + 5**3 + 3**3), a sum of factorials (1! + 2! + 3! + 4! + 5!), and a Vampire Number (3 * 51).
Update: The book is 'The Loom of God'. A 40-digit V-num is listed there: 98765432198765432198 * 98765432198830604534 = 9754610597415368368844499268390128385732, whew!