Is it a vampire number?
Repost and improvement of this challenge from 2011
A vampire number is a positive integer \$v\$ with an even number of digits that can be split into 2 smaller integers \$x, y\$ consisting of the digits of \$v\$ such that \$v = xy\$. For example:
$$1260 = 21 \times 60$$
so \$1260\$ is a vampire number. Note that the digits for \$v\$ can be in any order, and must be repeated for repeated digits, when splitting into \$x\$ and \$y\$. \$x\$ and \$y\$ must have the same number of digits, and only one can have trailing zeros.
You are to take a positive integer \$v\$ which has an even number of digits and output whether it's a vampire number or not. You can either output:
- Two consistent, distinct values
- A (not necessarily consistent) truthy value and a falsey value
- For example, "a positive integer for true, 0 for false"
You may input and output in any convenient method. This is code-golf, so the shortest code in bytes wins.
MetaIs it a vampire number?
- Is this clear enough?
- Is this worth reposting? The older linked question is the only open vampire numbers challenge on the site
- Tags are code-golf, number-theory, set-partitions
- Any further feedback?