Interestingly my nephew went to Sidwell Friends for elementary school while my kid went to a public school. They were both math whizzes. My kid’s school was much more amenable to providing differentiated work and eventually having him attend math several grades above his actual grade. SF had the attitude that all the kids were smart. They discouraged kids from doing the talent searches so my nephew did not get to participate in CTY which was the best thing my kid did in middle school.
That said, all public schools are not created equal. You need a good enough school. If you have a very advanced kid you need to be in a system where there are at least enough kids around to provide your kid some intellectual stimulation. My kid did not find math buddies until middle school (MathCounts thank you!) and that was hard, but he did find kids who read the same books and played the same games. Our public high school on paper did not look that good. SAT average scores were very average and there were too many kids falling between the cracks, but there was also a decent sized group of kids who were smart and motivated. They offered 22 AP classes and for the most part kids did very well on the APs.