### 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

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 2

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

^{100}-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.`

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

ReplyDeleteYou 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.

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.

Packers And Movers Hyderabad

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.

Packers And Movers Hyderabad

ReplyDeleteI 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.

Packers And Movers Hyderabad

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

ReplyDeleteplease visit are website..

Packers And Movers Hyderabad

Packers And Movers Lingampally Hyderabad

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

ReplyDeletereally 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

ReplyDeleteromantic messages for chocolate day

ReplyDeletechocolate day messages for a friend

kiss day message for boyfriend

happy kisss day husband quotes

Best Movers and Packers in India for Moving and Shifting Door to Door Transportation Services to all over India. Visit More :-

ReplyDeleteManish Packers and Movers Pvt Ltd Blog

Packers and Movers Bhopal

Packers and Movers Jabalpur

Packers and Movers Vadodara

Packers and Movers Udaipur

Packers and Movers Jaipur

Packers and Movers Chandigarh

Packers and Movers Chennai

Packers and Movers Hyderabad

Packers and Movers in Indore

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

ReplyDeletePackers And Movers MumbaiPackers 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

ReplyDeletePackers 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 @

ReplyDeletePackers And Movers Gurgaon

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.

ReplyDeleteTransportation Service Packer & Mover in GurgaonHey, 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.

ReplyDelete@ Packers And Movers Gurgaon

Packers And Movers Gurgaon to Bangalore

Packers And Movers Gurgaon to Ahmedabad

Packers And Movers Gurgaon to Jaipur

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

ReplyDeletePackers 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

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

ReplyDeletePackers And Movers Gurgaon

Packers And Movers Mirpur Gurgaon

Packers And Movers Khor Gurgaon

Packers And Movers Jawasi Gurgaon

Packers And Movers Indir Mewat Gurgaon

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

ReplyDeletePackers 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

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

ReplyDeleteMumbai 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

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.

ReplyDeletePlease visit our website: @ Packers and Movers Kolkata

Packers And Movers Mumbai to Haridwar

ReplyDeletePackers And Movers Mumbai to Noida

Packers And Movers Mumbai to Guntur

Packers And Movers Mumbai to Muzaffarpur

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

ReplyDeletethis 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

ReplyDeletePackers 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. @

ReplyDeletePackers And Movers BangalorePackers 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 - @

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

ReplyDeletePackers And Movers Chennai

ReplyDeleteشركة نقل اثاث عفش من الرياض الى جدة مكة

شركة نقل عفش من الرياض الى الدمام الاحساء الخبر الهفوف

شركة نقل عفش بالدمام

شركة نقل عفش من الرياض الى الدمام

شحن عفش من الرياض لمصر

QuickBooks Error 12152 is most common errors that everyone may face these problems ,

ReplyDeleteour team at QuickBooks Customer Service provide solutions for your quickbooks accounting software

Nice blog !! Are You looking for QuickBooks Solution QuickBooks Software For any issue then

ReplyDeleteconnect our team at QuickBooks Customer Service

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

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

ReplyDeleteKirti Pathak

Such a Nice and Informative Post. Thanks for Sharing

ReplyDeletePakistan Cargo Dubai