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 `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](https://oeis.org/A014575).

PPS: So called *Pseudo-Vampire Numbers* are treated in [this kata](http://www.codewars.com/kata/vampire-numbers-1).

Difficulty: EASY
Starter code: def VampireNumber(k):
	

Solutions:
is_vampire = lambda x, y: sorted(f'{x}{y}') == sorted(f'{x * y}') and x % 10 + y % 10 > 0
vampires = sorted({x * y for p in (1, 2) for x in range(10 ** p, 10 ** (p + 1)) for y in range(x, 10 ** (p + 1)) if is_vampire(x, y)})

def VampireNumber(k):
	return vampires[k - 1]


vampire_number = VampireNumber = (0, 1260, 1395, 1435, 1530, 1827, 2187, 6880, 102510, 104260, 105210, 105264, 105750, 108135, 110758, 115672, 116725, 117067, 118440, 120600, 123354, 124483, 125248, 125433, 125460, 125500, 126027, 126846, 129640, 129775, 131242, 132430, 133245, 134725, 135828, 135837, 136525, 136948, 140350, 145314, 146137, 146952, 150300, 152608, 152685, 153436, 156240, 156289, 156915, 162976, 163944, 172822, 173250, 174370, 175329, 180225, 180297, 182250, 182650, 186624, 190260, 192150, 193257, 193945, 197725, 201852, 205785, 211896, 213466, 215860, 216733, 217638, 218488, 226498, 226872, 229648, 233896, 241564, 245182, 251896, 253750, 254740, 260338, 262984, 263074, 284598, 284760, 286416, 296320, 304717, 312475, 312975, 315594, 315900, 319059, 319536, 326452, 329346, 329656, 336550, 336960, 338296, 341653, 346968, 361989, 362992, 365638, 368550, 369189, 371893, 378400, 378418, 378450, 384912, 386415, 392566, 404968, 414895, 416650, 416988, 428980, 429664, 447916, 456840, 457600, 458640, 475380, 486720, 489159, 489955, 498550, 516879, 529672, 536539, 538650, 559188, 567648, 568750, 629680, 638950, 673920, 679500, 729688, 736695, 738468, 769792, 789250, 789525, 792585, 794088, 809919, 809964, 815958, 829696, 841995, 939658).__getitem__


import requests
r = requests.get('https://oeis.org/A014575/b014575.txt')
vampire_numbers = [int(d.split(' ')[1]) for d in r.text.strip().split('\n')]

def VampireNumber(n):
	return vampire_numbers[n - 1]


def VampireNumber(k):
	return ord('_Ӭճ֛\u05faܣ\u088b\u1ae0\U0001906e\U00019744\U00019afa\U00019b30\U00019d16\U0001a667𛂦\U0001c3d8\U0001c7f5\U0001c94b\U0001cea8𝜘\U0001e1da\U0001e643𞥀\U0001e9f9\U0001ea14\U0001ea3c\U0001ec4b\U0001ef7e🩨\U0001faef𠂪𠕎𠡽𠹅𡊔𡊝𡕍𡛴𢐾𣞢𣫙𣸈𤬜𥐠𥑭𥝜𦉐𦊁𦓳𧲠𨁨𪌖𪓂𪤢𪳡𬀁𬁉𬟪𬥺𭤀𮜴\U0002ee96\U0002f2e9\U0002f599𰑝\U0003147c\U000323d9\U00033bb8\U000341da\U00034b34\U00034e9d\U00035226\U00035578\U000374c2\U00037638\U00038110\U000391a8\U0003af9c\U0003bdbe\U0003d7f8\U0003df36\U0003e314\U0003f8f2\U00040348\U000403a2\U000457b6\U00045858\U00045ed0\U00048580\U0004a64d\U0004c49b\U0004c68f\U0004d0ca\U0004d1fc\U0004de53\U0004e030\U0004fb34\U00050682\U000507b8\U000522a6\U00052440\U00052978\U00053695\U00054b58\U00058605\U000589f0\U00059446\U00059fa6\U0005a225\U0005acb5\U0005c620\U0005c632\U0005c652\U0005df90\U0005e56f\U0005fd76\U00062de8\U000654af\U00065b8a\U00065cdc\U00068bb4\U00068e60\U0006d5ac\U0006f888\U0006fb80\U0006ff90\U000740f4\U00076d40\U000776c7\U000779e3\U00079b76\U0007e30f\U00081508\U00082fdb\U0008381a\U00088854\U0008a960\U0008adae\U00099bb0\U0009bfe6\U000a4880\U000a5e4c\U000b2258\U000b3db7\U000b44a4\U000bbf00\U000c0b02\U000c0c15\U000c1809\U000c1de8\U000c5bbf\U000c5bec\U000c7356\U000ca900\U000cd90b\U000e568a'[k])


import requests
from bs4 import BeautifulSoup
page = requests.get(url='https://oeis.org/A014575/b014575.txt').text
soup = BeautifulSoup(page, 'html.parser')
vampire = {int(v.split(' ')[0]): int(v.split(' ')[1]) for v in soup.text.split('\n') if v}

def VampireNumber(i):
	return vampire[i]


import requests

def VampireNumber(n):
	r = requests.get('https://oeis.org/A014575/b014575.txt').text.splitlines()
	return int(r[n - 1].split()[1])


from itertools import combinations
vampires = set()
for i in [1, 2]:
	for (x, y) in combinations(range(10 ** i, 10 ** (i + 1)), 2):
		if x % 10 == 0 == y % 10:
			continue
		z = x * y
		if sorted(str(z)) == sorted(f'{x}{y}'):
			vampires.add(z)
xs = sorted(vampires)

def VampireNumber(i):
	return xs[i - 1]


is_vampire = lambda x, y: sorted(f'{x}{y}') == sorted(f'{x * y}') and x % 10 + y % 10 > 0
vampires = [None] + sorted({x * y for p in (1, 2) for x in range(10 ** p, 10 ** (p + 1)) for y in range(x, 10 ** (p + 1)) if is_vampire(x, y)})
VampireNumber = vampires.__getitem__


v_nums = {1: 1260, 2: 1395, 3: 1435, 4: 1530, 5: 1827, 6: 2187, 7: 6880, 8: 102510, 9: 104260, 10: 105210, 11: 105264, 12: 105750, 13: 108135, 14: 110758, 15: 115672, 16: 116725, 17: 117067, 18: 118440, 19: 120600, 20: 123354, 21: 124483, 22: 125248, 23: 125433, 24: 125460, 25: 125500, 26: 126027, 27: 126846, 28: 129640, 29: 129775, 30: 131242, 31: 132430, 32: 133245, 33: 134725, 34: 135828, 35: 135837, 36: 136525, 37: 136948, 38: 140350, 39: 145314, 40: 146137, 41: 146952, 42: 150300, 43: 152608, 44: 152685, 45: 153436, 46: 156240, 47: 156289, 48: 156915, 49: 162976, 50: 163944, 51: 172822, 52: 173250, 53: 174370, 54: 175329, 55: 180225, 56: 180297, 57: 182250, 58: 182650, 59: 186624, 60: 190260, 61: 192150, 62: 193257, 63: 193945, 64: 197725, 65: 201852, 66: 205785, 67: 211896, 68: 213466, 69: 215860, 70: 216733, 71: 217638, 72: 218488, 73: 226498, 74: 226872, 75: 229648, 76: 233896, 77: 241564, 78: 245182, 79: 251896, 80: 253750, 81: 254740, 82: 260338, 83: 262984, 84: 263074, 85: 284598, 86: 284760, 87: 286416, 88: 296320, 89: 304717, 90: 312475, 91: 312975, 92: 315594, 93: 315900, 94: 319059, 95: 319536, 96: 326452, 97: 329346, 98: 329656, 99: 336550, 100: 336960, 101: 338296, 102: 341653, 103: 346968, 104: 361989, 105: 362992, 106: 365638, 107: 368550, 108: 369189, 109: 371893, 110: 378400, 111: 378418, 112: 378450, 113: 384912, 114: 386415, 115: 392566, 116: 404968, 117: 414895, 118: 416650, 119: 416988, 120: 428980, 121: 429664, 122: 447916, 123: 456840, 124: 457600, 125: 458640, 126: 475380, 127: 486720, 128: 489159, 129: 489955, 130: 498550, 131: 516879, 132: 529672, 133: 536539, 134: 538650, 135: 559188, 136: 567648, 137: 568750, 138: 629680, 139: 638950, 140: 673920, 141: 679500, 142: 729688, 143: 736695, 144: 738468, 145: 769792, 146: 789250, 147: 789525, 148: 792585, 149: 794088, 150: 809919, 151: 809964, 152: 815958, 153: 829696, 154: 841995, 155: 939658}

def VampireNumber(k):
	return v_nums[k]