## Teaser 2994: Consecutive sums

**From The Sunday Times, 9th February 2020** [link]

Amelia noticed that 15 is equal to 1+2+3+4+5 or 4+5+6 or 7+8, so there are three possible ways that it can be expressed as the sum of consecutive whole numbers. She then told Ben that she had found a three-digit number which can be expressed as the sum of consecutive whole numbers in just two different ways. “That’s interesting”, said Ben. “I’ve done the same, but my number is one more than yours”.

What is Ben’s number?

[teaser2994]

## Jim Randell 5:36 pm

on7 February 2020 Permalink |The following Python program runs in 221ms.

Run:[ @repl.it ]Solution:Ben’s number is 289.289 can be expressed as:

Amelia’s number is 288, which can be expressed as:

LikeLike

## Jim Randell 6:36 pm

on7 February 2020 Permalink |Here is a neater program that uses the technique described in the comments of

Enigma 1. It runs in 83ms.Run:[ @repl.it ]Analytically:

In order for the numbers to have exactly 3 odd divisors they must be of the form:

where

pis an odd prime.And we are looking for two consecutive numbers, so one will be even and one will be odd (

k = 0).We can look for 3-digit numbers manually, or programatically:

We find the following 3-digit numbers with exactly 3 odd divisors:

And there are only two consecutive numbers in this list:

LikeLike