Sunday Times Teaser 2854 – Power Surge
by Andrew Skidmore
Published June 4 2017 (link)
I recently checked my energy bills. I noticed that the account numbers for my electricity and gas are two different sixfigure numbers, and that one is a multiple of the other. The electricity account number is a perfect cube and the sum of its digits is a perfect square. The gas account number is a perfect square (and, as it happens, the sum of its digits is a perfect cube!).
What is the gas account number?
2 Comments
Leave one →

geoffrounce permalink12345678910111213141516171819202122232425262728def is_cube(n):c = int(n ** (1 / 3) + 0.5)return (c ** 3 == n)def is_sq(n):c = int(n ** (1 / 2) + 0.5)return (c ** 2 == n)gas_sq = [x * x for x in range(316, 1000)]elec_cb = [x * x * x for x in range (47, 100)]gas_list = []elec_list = []for e in elec_cb:for g in gas_sq:if e % g == 0 and e != g:gas_list += [g]elec_list += [e]for g in gas_list:sum_g = sum(int(x) for x in str(g))for e in elec_list:sum_e = sum(int(x) for x in str(e))if is_cube(sum_g) and is_sq(sum_e) and e % g == 0:print('Gas account no. = {}, Electricity account no. = {}'.format (g, e))