### The Chick Peck Problem

So, my plans for my blog through 2017 have not quite gone to plan, but things have been horrendously busy, and it seems like the rest of the year is likely to continue this way.

But I did get a chance to do some recreational mathematics, spurred on my a story in the news. It's to do with a problem presented at the 2017 Raytheon MATHCOUNTS® National Competition and reported in the New York Times. Here's the question as presented in the press:

Kudos to 13 year old Texan, Luke Robitialle, who got this right.

With a little thought, you should be able to realise that the answer is 25. For any particular chick, there are four potential out comes, each with equal probability. Either the chick is
• pecked from the left
• pecked from the right
• pecked from left and right
• not pecked at all
Only one of these options results in the chick being unpecked, and so the expected number of chicks unpecked in a circle of 100 is one quarter of this number, or 25.

ABC journalist and presenter extraordinaire, Leigh Sales, tweeted
But it's the kind of maths that makes me ask more questions.

While 25 is the expected number of unpecked chicks, what is the distribution of unpecked chicks? What I mean by this is that they peck left or right at random, there might be 24 unpecked chicks for one group of a hundred chicks, 25 for the next, and 23 for the next. So, the question is, given a large number of 100 chick experiments, what's the distribution of unpecked chicks?

I tried to find an analytic solution, but my brain is old, and so I resorted to good old numerical methods. Generate lots of experiments on a computer, and see what the outcomes look like. But there is an issue that we have to think about, namely the question of how many different configurations of chicks pecking left and right can have?

Well, left and right are two options, and for 100 chicks, the number of possible left and right configurations is

That's a lot of possibilities! How are we going to sample these?

Well, if we treat a 0 as "chick pecks to the left", and 1 as "check pecks to the right", then if we choose a random integer between 0 and 2100-1,  and represent it as a binary number, then that will be a random sampling of the pecking order (pecking order, get it!) As an example, all chicks peck to the left would be 100 0s in binary, where as all the chicks peck to the right would be 100 1s in binary.

Let's try a randomly drawn integer in the range. We get (in base 10) 333483444300232384702347234. In binary this is

`0000000000010001001111011001110111011011110101101010111100001100011100100110100100000111011111100010`
`So, the first bunch of chicks peck to the left, then we have a mix of right to left pecks. `
`But how many of these chicks are unpecked (remembering what the original question)? Well, for any particular chick, it will be unpecked if the chick to its left pecks to the left, and the chick to its right pecks to the right. So, we're looking for sequences of '001' and '011', with the middle digit representing the chick we are interested in. `
`So, we can chick this into a little python code (had to learn it, all the cool kids are using it these days) and this is what I have`
`There is a little extra in there to account for the fact that the chicks are sitting in a circle, but as you can see, the code is quite compact.`
`OK. Let's run for the 100 chicks in the question. What do we get?`
`Yay! The unpecks peak at 25, but there is a nice distribution (which, I am sure, must have an analytic solution somewhere. `
`But given the simplicity of the code, I can easily change the number of chicks. What about 10 chicks in circle?`
`Hmmm. Interesting. What about 1000 chicks?`
`And 33 chicks?`
`Most likely number of unpecked chicks is 8, but again, a nice distribution. `
`Now, you might be sitting there wondering why the heck I am doing this? Well, firstly, because it is fun! And interesting! It's a question and it is fun to find the answer. `
`Secondly it is not obvious what the distribution would be, and how complex it would be to derive, or even if it exists, and so a numerical approach allows us to find an answer. `
`Finally, I can easily generalize this to questions like "what if the left pecks are more likely than right pecks by a factor of two, what would the distribution be like?" It would just take a couple of lines of code and I would have an answer. `
`And if you can't see how such curiosity led examinations are integral to science, then you don't know what science is.`

1. I have re-blogged this at https://newtonexcelbach.wordpress.com/2017/06/16/counting-non-pecked-chicks/ with some added Excel and VBA versions.

You probably won't be very impressed with the pure Excel versions (which are much slower), but you might like the Excel/xlwings link to your Python code.

2. I cannot truly enable but admire your weblog, your weblog is so adorable and great.It has given me courage to try scarier things. I tend to steer clear of them but not anymore.

3. I cannot truly enable but admire your weblog, your weblog is so adorable and great.It has given me courage to try scarier things. I tend to steer clear of them but not anymore.

4. I cannot truly enable but admire your weblog, your weblog is so adorable and great.It has given me courage to try scarier things. I tend to steer clear of them but not anymore.

5. nice really like your blog, thanks for share...

6. really a vry nice blog i really appreciate all your efforts ,thank you so mch for sharing this valuable information with all of us. Packers And Movers Jaipur

7. really a vry nice blog i really appreciate all your efforts ,thank you so mch for sharing this valuable information with all of us. Packers And Movers Jaipur

8. Hire Manish Packers and Movers Pvt Ltd in India for hassle-free Household Shifting, Office Relocation, Car Transportation, Loading Unloading, packing Unpacking at affordable Price Quotation. Top Rated Safe and Secure Service Providers who can help you with 24x7 and make sure a Untroubled Relocation Services at Cheapest/Lowest Rate. Visit More :-
Manish Packers and Movers Pvt Ltd
Packers and Movers Bangalore
Packers and Movers Gurgaon
Packers and Movers Indore
Packers and Movers Kolkata
Packers and Movers Mumbai
Packers and Movers Nagpur
Manish Packers in Indore
Manish Packers and Movers Pvt Ltd Sitemap

9. Manish Packers and Movers Pvt Ltd as a Services providing company can make all the difference to your Home Relocation experience. Indore based Company which offers versatile solutions, Right team that easily reduce the stress associated with a Household Shifting, Vehicle Transportation. we help things run smoothly and reduce breakages and offer you seamless, Affordable, Reliable Shifting Services, Compare Shifting Charges, Visit :
Manish Packers and Movers Ptv Ltd @ https://www.manishpackersmoversindore.in/
Packers and Movers Indore @ https://www.manishpackersmoversindore.in/packers-and-movers-indore.html
Manish Packers Indore @ https://www.manishpackersmoversindore.in/manish-packers-and-movers-indore.html
Packers and Movers Gurgaon @ https://www.manishpackersmoversindore.in/packers-movers-gurgaon.html
Packers and Movers Kolkata @ https://www.manishpackersmoversindore.in/packers-movers-kolkata.html
Packers and Movers Mumbai @ https://www.manishpackersmoversindore.in/packers-movers-mumbai.html
Packers and Movers Bhopal @ https://www.manishpackersmoversindore.in/packers-movers-bhopal.html
Packers and Movers Nagpur @ https://www.manishpackersmoversindore.in/packers-movers-nagpur.html
Packers and Movers Raipur @ https://www.manishpackersmoversindore.in/packers-movers-raipur.html

10. Hire Best Packers And Movers Mumbai for hassle-free Household Shifting, ***Office Relocation, ###Car Transporation, Loading Unloading, packing Unpacking at affordable ✔✔✔ Price Quotation. Top Rated, Safe and Secure Service Providers who can help you with 24x7 and make sure a Untroubled Relocation Services at Cheapest/Lowest Rate
Packers And Movers Mumbai

11. Packers and Movers Ahmedabad - We Provide ***Best Service Providers, Safe, Reliable, Affordable, Trusted ###Movers and Packers in Ahmedabad List, Household Shifting, Office Relocation: Choose Top Verified Packers and Movers Ahmedabad Compare ???Shifting Service Chrages, Price Quotation, Rate List Charts and Save Money and Time @ Packers and Movers Ahmedabad

12. Packers and Movers Gurgaon Provide Reliable, Safe and Certified Service Provider list, Get Free ***Best Price Quotaition and Compare Charges. ???Hassle free Household Shifting Services, High Quality packing Material, Office Relocation, Car Transportaion, ###Local and Domestic Shifting Service @
Packers And Movers Gurgaon

13. Get Shifting/Relocation Quotation from ###Packers and Movers Delhi. Packers and Movers Delhi 100% Affordable and Reliable ***Household Shifting Services. Compare Transportation Charges and Save Time, Verified and Trusted Packers and Movers in Delhi, Cheap and Safe Local, Domestic House Shifting @
Packers And Movers Delhi

14. Thanks for sharing Such a valuable information.Im very thankful to You That You Had Given Me This opportunity to write on This blog.please visit our website I Assure You That it will be very useful for @ Packers And Movers Gurgaon

15. Thanks for sharing such a valuable information.Im very thankful to you that you had given me this opportunity to write on this blog.please visit our website I assure you that it will be very useful for @ Packers And Movers Hyderabad

16. Excellent and decent post. I found this much informative, as to what I was exactly searching for. Thanks for such post and please keep it up.
Transportation Service Packer & Mover in Gurgaon

17. Hey, Wow all the posts are very informative for the people who visit this site. Good work! We also have a Blog.Please feel free to visit our site. Thank you for sharing.
@ Packers And Movers Gurgaon
Packers And Movers Gurgaon to Bangalore
Packers And Movers Gurgaon to Ahmedabad
Packers And Movers Gurgaon to Jaipur

18. Enjoyed every bit of your blog article.Really looking forward to read more. Really Cool. @
Packers And Movers Delhi
Packers And Movers Greater Noida
Packers And Movers Noida

19. Really impressive post. I read it whole and going to share it with my social circules. I enjoyed your article and planning to rewrite it on my own blog
Packers And Movers Delhi
Packers And Movers Dwarka Delhi
Packers And Movers Anand Vihar Delhi
Packers And Movers Mayur Vihar Delhi
Packers And Movers Sonia Vihar Delhi
Packers And Movers Yamuna Vihar Delhi

20. Really impressive post. I read it whole and going to share it with my social circules. I enjoyed your article and planning to rewrite it on my own blog
Packers And Movers Gurgaon
Packers And Movers Mirpur Gurgaon
Packers And Movers Khor Gurgaon
Packers And Movers Jawasi Gurgaon
Packers And Movers Indir Mewat Gurgaon

21. Get Packers and Movers Kolkata List of Top Reliable, 100% Affordable, Verified and Secured Service Provider. Get Free ###Packers and Movers Kolkata Price Quotation instantly and Save Cost and Time. ???Packers and Movers Kolkata Reviews and Compare Charges for household Shifting, Home/Office Relocation, ***Car Transportation, Pet Relocation, Bike SHifting @ Packers and Movers Kolkata

22. Packers and Movers Hyderabad Give Certified and Verified Service Providers, Cheap and Best ###Office Relocation Charges, ***Home Shifting, ✔✔✔Goods Insurance worth Rs. 10,000, Assurance for Local and Domestic House Shifting. Safe and Reliable Household Shifting Services in Hyderabad with Reasonable Packers and Movers Price Quotation @ Packers And Movers Hyderabad

23. Packers and Movers Chennai Give Safe and Reliable ***Household Shifting Services in Chennai with Reasonable ###Packers and Movers Price Quotation. We Provide Household Shifting, Office Relocation, ✔ ✔ ✔ Local and Domestic Transportation Services, Affordable and Reliable Shifting Service Charges. @ Packers And Movers Chennai

24. A suggested Incall or Outcall Mumbai Escorts Service ability in five star Hotels (Dial-9100000000).A wide variety of Independent Escorts in Mumbai

Mumbai Escorts Models | Mumbai Model Escorts | Cheap Mumbai Escorts | Mumbai Independent Escorts | Escorts Girls in Mumbai | Mumbai Escorts Girls | Call Girls Mumbai | College Escort in Mumbai | Escorts Service Mumbai| Mumbai Escorts

25. Superb post, we enjoyed each and everything as per written in your post. Thank you for this informative article because it’s really helpful, I really like site.

26. an awesome blog thanks a lot for giving me this great opportunity to write on this.please visit our website I assure you that it will be very useful for you @ Packers and Movers mumbai

27. Hey, What's up, I'm Shivani. I'm an application developer living in Noida, INDIA. I am a fan of technology. I'm also interested in programming and web development. You can download my app with a click on the link.
Best astrology app
Astro guru tips
Astro guru tips
Free horoscope
Best astrology app for android
Hindi astrology app
Best kundli app
Astrology app in hindi
Kundli app

28. Packers And Movers Bangalore Local Household Shifting Service, Get Free Best Price Quotes Local Packers and Movers in Bangalore List, Compare Charges, Save Money And Time at
Local Packers And Movers Bangalore

29. Thank you very much for writing such an interesting article on this topic. This has really made me think and I hope to read more. @ Packers and Movers mumbai

30. Astogurutips is the top best Online Astrology website in India with more than 500+ astrologer on the portal. He gives a Best Astrology solutions from the Best Astrologers . You can connect with our astrologer through call or chat and ask you any question about your carrier, health, future, love partner etc. Free astrology service on phone

31. this is really nice and effective blog, i found lots of information in this blog and sites for commenting is best.Very nice I like a lot of these topics...@ Packers and Movers Ahmedabad

32. Packers and Movers Bangalore as a Services providing company can make all the difference to your ###Home Relocation experience. Bangalore based Company which offers versatile solutions, Right team that easily reduce the stress associated with a ???Household Shifting, ***Vehicle Transportation. we help things run smoothly and reduce breakages and offer you seamless, Affordable, Reliable Shifting Services, Compare Shifting Charges. @ Packers And Movers Bangalore

33. Good Blog with good Pictures, i really like it.We provides Packers and movers in india, we have
all types of Packers and movers normal and affordable which is available for local and outstation Services.
Packers and Movers in Gurgaon
Movers and Packers in Chandigarh
Movers and Packers in India

34. Your site is truly cool and this is an extraordinary moving article. @ Packers And Movers Chennai

35. Packers and Movers Bangalore - Reliable and Verified Household Shifting Service Providers Give Reasonable ###Packers and Movers Charges. Cheap and Best Office Relocation Compare Quotation for Assurance for Local and Domestic House Shifting and Get estimates today to save upto 20%, ***Read Customer Reviews - @ Packers And Movers Bangalore

36. Nice & Informative Blog !
In case you are searching for the best technical services for QuickBooks, call us at QuickBooks Error 2107 1-855-977-7463 and get impeccable technical services for QuickBooks. We make use of the best knowledge for solving your QuickBooks issues.

37. Thanks on your marvelous posting! I really enjoyed reading it, you’re a great author.Please visit here: @Packers And Movers Chennai

38. QuickBooks Error 12152 is most common errors that everyone may face these problems ,
our team at QuickBooks Customer Service provide solutions for your quickbooks accounting software

39. Nice blog !! Are You looking for QuickBooks Solution QuickBooks Software For any issue then
connect our team at QuickBooks Customer Service

40. Really I m feeling very happy after read your article just click get QuickBooks Solution information at QuickBooks Customer Service

41. Tech AP News The technology sector changes rapidly. It seems like every day a new gadget is being made available to the public. For those "techies" interested in the latest and greatest technological information, a good tech news blog or website is a great way to stay informed.
Games Special In this contemporary world, it has become liable to access each and everything with modern technologies; therefore, gaming peripherals are the best gaming devices which comfort the gamers who love to play the ideal games with easy and accessible device to play their skills.
Business If you think about it you can see that the news media has been evolving for some time. Business news was once only available in a newspaper that changed when television arrived on the scene.
Tech Roboting It is very important to keep yourself updated as far as the technology is concerned. You should try to get your hands of the latest technology and gadgets as soon as they hit the market.
Out Reach Galaxy Outreach Galaxy is a platform that merchandise guest posts only with no limitation to minimum guest posts or any SEO metrics. Further, there’s no evaluation for home page features or any other requirements
Crick Time In the sports arena, peak performance in sports has always been a much sought after state by players and coaches of all levels. Whether the athletes are school boys soccer players or Olympians striving for their Gold medals, peak performance in sports has always attracted athletes and coaches alike.
Care Me Tutor Careme Tutor” is a web based platform founded in 2018 that connects an increasing number of teachers with students for private, home sessions in the Pakistan.

42. Your post is truly awesome. It is appreciable piece of efforts done by you.

Kirti Pathak