Problem 45

Python 3

 1def gen_pent_num(num):
 2    return (num * (3 * num - 1))/2
 3def gen_hex_num(num):
 4    return (num * (2*num -1))
 5
 6pent_num = list()
 7hex_num = list()
 8
 9for i in range(1000, 55000):
10    pent_num.append(gen_pent_num(i))
11    hex_num.append(gen_hex_num(i))
12for num in pent_num:
13    if num in hex_num:
14        print(int(num))
15        exit()