7 kyu
Vampire numbers less than 1 000 000
137zieglerk
Description:
A Vampire number is a positive integer z
with a factorization x * y = z
such that
x
andy
have the same number of digits and- the multiset of digits of
z
is equal to the multiset of digits ofx
andy
. - Additionally, to avoid trivialities,
x
andy
may not both end with0
.
In this case, x
and y
are called fangs of z
. (The fangs of a Vampire number may not be unique, but this shouldn't bother us.) The first three Vampire numbers are
1260 = 21*60
1395 = 15*93
1435 = 35*41
Write an algorithm that on input k
returns the k
th Vampire number. To avoid time-outs, the Python version will test with 1 <= k <= 155
.
PS: In the OEIS, the Vampire numbers are sequence A014575.
PPS: So called Pseudo-Vampire Numbers are treated in this kata.
Puzzles
Similar Kata:
Stats:
Created | Jun 26, 2015 |
Published | Jul 11, 2015 |
Warriors Trained | 607 |
Total Skips | 12 |
Total Code Submissions | 1288 |
Total Times Completed | 137 |
Python Completions | 137 |
Total Stars | 5 |
% of votes with a positive feedback rating | 64% of 63 |
Total "Very Satisfied" Votes | 33 |
Total "Somewhat Satisfied" Votes | 15 |
Total "Not Satisfied" Votes | 15 |
Total Rank Assessments | 4 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 8 kyu |