# Simulating Misanthropic Neighbors

But what’s the expected fraction of occupied houses as the development gets larger, that is, as N goes to infinity?My a priori reasoning went:Best case = 1/2 occupied housesWorst case = 1/3 occupied housesMean case = 5/12 occupied housesAs N grows infinitely large, the fraction of occupied houses will approach the mean case.There is variability in the best, worst, & middle cases depending on N being odd or even, as well as its size (in fact, odd N’s can do better than 1/2 in edge cases for large N’s, & very often for small N’s)..However, these marginal variances should shrink asymptotically to zero as N approaches infinity.To test this, I created a simulation function in R:… then whipped that code into an interactive shiny app:Full shiny code in this repo: https://github.com/dnlmc/538Per the simulation, the proportion of occupied houses converges to ~ .432… as N grows larger.My a priori conjecture was 5/12, or roughly .41666…As we used to say in my old job: close enough for government work.It also got me a nice shoutout in the following week’s solution post on 538:In light of the full analytic solution, my attempt at an a priori estimate was a bit …heuristic & under-developed..But it got within ~ .016 of the correct answer — & didn’t require me to bother with any ‘second-order non-homogeneous recurrence relations with variable coefficients’ — so I’m gonna go ahead & chalk that up as a win.If you agree (or don’t), follow me & check out my other posts :)— Follow on twitter: @dnlmcLinkedIn: linkedin.com/in/dnlmcGithub: https://github.com/dnlmc. More details