Problem 51251. Locate a family on a long street
Two children, Matilda and Labrun, live on a street in which—unlike many streets in the U.S.—the houses on one side are numbered consecutively, starting at 1. They notice that the sum of the numbers on the houses to the left of theirs equals the sum of the numbers to the right. 
Write a function that takes 
, the maximum number of houses on the street, and returns the largest possible number of houses and the number of the house where the family of Matilda and Labrun lives. For example, if 
 = 10, then the function should find that the street has 8 houses and Matilda and Labrun live in house 6 because 1+2+3+4+5 = 7+8 = 15.
Solution Stats
Problem Comments
- 
		1 Comment
 
		ChrisR
    	on 16 May 2021
	
	
  	Test added to discourage lookup solutions.
Solution Comments
Show commentsProblem Recent Solvers21
Suggested Problems
- 
         
Remove the two elements next to NaN value
682 Solvers
 - 
         
Find the elements of a matrix according to a defined property.
90 Solvers
 - 
         
Get the elements of diagonal and antidiagonal for any m-by-n matrix
503 Solvers
 - 
         
         
292 Solvers
 - 
         
         
85 Solvers
 
More from this Author314
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!