Teaser 2559: Inconsequential
From The Sunday Times, 9th October 2011 [link] [link]
Most whole numbers can be expressed as the sum of two or more consecutive whole numbers. For example:
35 = 17 + 18
36 = 11 + 12 + 13
40 = 6 + 7 + 8 + 9 + 10I have written down two whole numbers. Between them they use each of the digits 0 to 9 exactly once. But neither of the numbers can be expressed as the sum of two or more consecutive whole numbers.
What are my two numbers?
[teaser2559]
Jim Randell 8:39 am on 25 March 2025 Permalink |
I am assuming that by “whole numbers” the setter means the positive integers.
We have encountered the polite numbers [@wikipedia] before, see: BrainTwister #43, Enigma 776, Teaser 2994, Enigma 914, Enigma 1231, Enigma 1.
The “impolite” numbers are the powers of 2, so we need to find two powers of 2 that between them use each of the 10 digits exactly once.
This Python program runs in 62ms. (Internal runtime is 134µs).
from enigma import (distinct_chars, printf) # record powers of 2 (as strings) ps = list() n = 1 while True: s = str(n) if len(s) > 9: break # look for a pair that use all 10 digits between them for x in ps: if distinct_chars(x, s) == 10: printf("{x}, {n}") ps.append(s) n *= 2Solution: The numbers are: 4, 536870912.
Where:
LikeLike