A certain street has between 5 0 and 5 0 0 houses in a row, numbered 1 , 2 , 3 , 4 , … consecutively.
There is a certain house m on the street such that the sum of all the house numbers to the left side of it is equal to the sum of all the house numbers to its right.
If the number of houses on street is n , enter m + n as answer.
Bonus: Can continued fractions be used here?
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.
2 ( m − 1 ) m = 2 n ( n + 1 ) − 2 ( m − 1 ) m − m ⟹ 2 m 2 = n ( n + 1 )
since g c d ( n , n + 1 ) = 1 and, for n > 1 , two consecutive integers cannot be both squares, we can either have
1- n = 2 k 2 and n + 1 = t 2 , when m = t . k , g c d ( t , k ) = 1 ,
or
2- n = k 2 and n + 1 = 2 . t 2 , when m = t . k , g c d ( t , k ) = 1 ,
Therefore, we need to find k and t in the range 5 0 ≈ 8 to 5 0 0 ≈ 2 2 such that they satisfy 1 or 2. For that we may make write all the squares from 5 0 to 5 0 0 in a row and also the same row, multiplied by two, in another row. then we need to see which two (one from the first row and the other from the second row) have a difference of 1 . n + 1 = t 2 = 2 8 9 and n = 2 × k 2 = 2 × 1 4 4 constitute the only valid pair.
n + m = 2 8 8 + 2 0 4 = 4 9 2
A brute force solution: Flatten [ Table [ t = 2 1 n ( n + 1 ) ; Table [ s = 2 1 m ( m − 1 ) ; If [ s = t − ( m + s ) , { m , n , t , s , m + n , t − ( m + s ) } , Nothing ] , { m , n } ] , { n , 5 0 , 5 0 0 } ] , 2 ] ⇒ { 2 0 4 , 2 8 8 , 4 1 6 1 6 , 2 0 7 0 6 , 4 9 2 , 2 0 7 0 6 } . Otherwise the same solution as Alak Bhattacharya.
From the given conditions of the problem we get m^2=n(n+1)/2, with 50<n<500. The solution of this with the constraint m, n are positive integers is m=204 and n=288, so that their sum is 492
Problem Loading...
Note Loading...
Set Loading...
The sum of all the positive integers from 1 to n can be represented by 2 ( n ) ( n + 1 ) . If we take the sum of all the numbers of the houses from 1 to n , and subtract the sum of all the numbers of the houses from 1 to m (represented by 2 ( n ) ( n + 1 ) − 2 ( m ) ( m + 1 ) ), we will get the sum of the houses that are above m and below or equal to n . However, this is also equal to the sum of the numbers from 1 to m − 1 , (given). This leaves us with this equation: 2 ( n ) ( n + 1 ) − 2 ( m ) ( m + 1 ) = 2 ( m − 1 ) ( m ) ( n ) ( n + 1 ) = ( m − 1 ) ( m ) + ( m ) ( m + 1 ) ( n ) ( n + 1 ) = 2 m 2 2 ( n ) ( n + 1 ) = m 2 For 2 ( n ) ( n + 1 ) to be a square, either both n and 2 n + 1 must be a square, or both 2 n and n + 1 must be. In other words, we want twice a square to be one away from another square. Testing all possible values of n such that 5 0 < n < 5 0 0 :
The only value of n that worked was 2 8 8 . And sure enough, 2 ( 2 8 8 ) ( 2 8 9 ) = 4 1 6 1 6 = 2 0 4 2 , giving us a result of m = 2 0 4 .