Vampire number

From Rosetta Code
Revision as of 13:09, 22 March 2013 by rosettacode>Fwend (added draft task)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Vampire number is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

A Vampire number is a natural number with an even number of digits, that can be factored into two integers. These 2 factors are called the fangs, and must have the following properties:

  • they each have half the number of the digits of the orginal number
  • together they consist of exactly the same digits as the orginal number
  • at most one of them has a trailing zero

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

Task description:

  1. Print the first 25 Vampire numbers and their fangs.
  2. 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 1 pair of fangs.

Cf: