7 kyu

Vampire numbers less than 1 000 000

Description:

A Vampire number is a positive integer z with a factorization x * y = z such that

  • x and y have the same number of digits and
  • the multiset of digits of z is equal to the multiset of digits of x and y.
  • Additionally, to avoid trivialities, x and y may not both end with 0.

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 kth 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

More By Author:

Check out these other kata created by zieglerk

Stats:

CreatedJun 26, 2015
PublishedJul 11, 2015
Warriors Trained607
Total Skips12
Total Code Submissions1288
Total Times Completed137
Python Completions137
Total Stars5
% of votes with a positive feedback rating64% of 63
Total "Very Satisfied" Votes33
Total "Somewhat Satisfied" Votes15
Total "Not Satisfied" Votes15
Total Rank Assessments4
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • zieglerk Avatar
  • bidouille Avatar
  • hobovsky Avatar
  • Fuzzi Avatar
Ad