How many integers from 1 to 1,000,000 inclusive, cannot be written as the sum of 2 or more consecutive positive integers?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Note: all the considerations below are referred to the specific case (integers from 1 to 1.000.000).
When you sum two consecutive numbers you obtain only odd numbers, greater or equal to 3:
n + ( n + 1 ) = 2 n + 1 = [ 3 , 5 , 7 , 9 , 1 1 , . . . . ]
when you sum three consecutive numbers you obtain multiples of 3, greater or equal to 6:
n + ( n + 1 ) + ( n + 2 ) = 3 n + 3 = 3 ( n + 1 ) = [ 6 , 9 , 1 2 , 1 5 , . . . . . ]
When you sum four consecutive numbers you obtain even numbers at a distance of four each other, greater or equal to 10:
n + ( n + 1 ) + ( n + 2 ) + ( n + 3 ) = 4 n + 6 = 2 ( 2 n + 3 ) = [ 1 0 , 1 4 , 1 8 , 2 2 , . . . . ]
When you sum five consecutive numbers you obtain only multiples of 5 greater or equal to 15:
n + ( n + 1 ) + ( n + 2 ) + ( n + 3 ) + ( n + 4 ) = 5 n + 1 0 = 5 ( n + 2 ) = [ 1 5 , 2 0 , 2 5 , 3 0 , 3 5 , . . . . ]
In general, when you sum x consecutive numbers you obtain:
n + ( n + 1 ) + ( n + 2 ) + ( n + 3 ) + . . . + ( n + x − 1 ) = x n + 2 ( x − 1 ) × ( x ) = x n + 2 ( x 2 − x )
In words it's "x" times the first number of the sequence plus the sum of the first (x - 1) integers
It's easy to see that none of the possible sequences can contain any power of 2.
So those are the only numbers you cannot obtain as a sum of two or more consecutive positive integers. In this case they are the ones from 2 0 [ = 1 ] to 2 1 9 [ = 5 2 4 2 8 8 ] for a total amount of 20 numbers