24 lines
1011 B
Plaintext
24 lines
1011 B
Plaintext
A [[wp:Vampire_number|vampire number]] is a natural 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 digits of the original number
|
|
* together they consist of exactly the same digits as the original number
|
|
* at most one of them has a trailing zero
|
|
|
|
<br>
|
|
An example of a Vampire number and its fangs: <code> 1260 : (21, 60) </code>
|
|
|
|
|
|
;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:
|
|
<big><code> 16758243290880, 24959017348650, 14593825548650 </code></big>
|
|
|
|
<br>
|
|
Note that a Vampire number can have more than one pair of fangs.
|
|
|
|
|
|
;See also:
|
|
* [http://www.numberphile.com/videos/vampire_numbers.html numberphile.com].
|
|
* [http://users.cybercity.dk/~dsl522332/math/vampires/ Vampire search algorithm]
|
|
* [[oeis:A014575|Vampire numbers on OEIS]]
|
|
<br><br>
|