SERVING THE QUANTITATIVE FINANCE COMMUNITY

 
User avatar
trackstar
Topic Author
Posts: 27805
Joined: August 28th, 2008, 1:53 pm

Christmas Cookie Algorithm

November 29th, 2020, 11:21 pm

Christmas Cookies

I will try to make a brainteaser; I don't know if it will be challenging or not, but let's find out.

(Also based in truth!):  I have a box of Christmas cookies and there are ten different types.

Two are plain
Two are filled with or topped with chocolate
One is filled with mint chocolate
One has chocolate and nuts on it
One has nuts in it
One has coconut in it
One has raspberry jam in it.
One has apricot jam in it.

Here are the rules:

If I eat one with chocolate, a non chocolate cookie must follow.
If I eat one with nuts, a cookie with jam must follow.
A coconut cookie cannot follow a chocolate or jam cookie.
A mint chocolate cookie cannot come before or after a cookie with nuts on it or in it.
A plain cookie cannot be eaten just before a chocolate cookie.
Two plain cookies cannot be eaten in a row.
If a raspberry jam cookie is eaten just after cookie x, an apricot cookie has to be eaten before cookie x.

How can I eat twenty cookies and still follow these rules, and without simply repeating a compliant 1-10 sequence?

PS: If you try to solve it, I will send you a virtual cookie.

If no one tries, that is fine because this made me laugh even thinking about it. : )
cookie small.jpg
 
User avatar
katastrofa
Posts: 9852
Joined: August 16th, 2007, 5:36 am
Location: Alpha Centauri

Re: Christmas Cookie Algorithm

December 1st, 2020, 1:59 am

But you wrote that you have only 10 cookies!
 
User avatar
Paul
Posts: 11049
Joined: July 20th, 2001, 3:28 pm

Re: Christmas Cookie Algorithm

December 2nd, 2020, 10:45 pm

But you wrote that you have only 10 cookies!
I thought it was me.

Is a coconut a nut here? I assume not. 

Do "follow," "after" "before" etc. mean immediately? You use "just" later on, it made me wonder. I assume they do.

Ok, I have one sequence, but have sadly lost interest...it's not you, it's me!
 
User avatar
trackstar
Topic Author
Posts: 27805
Joined: August 28th, 2008, 1:53 pm

Re: Christmas Cookie Algorithm

December 2nd, 2020, 11:12 pm

But you wrote that you have only 10 cookies!
I thought it was me.

Is a coconut a nut here? I assume not. 

Do "follow," "after" "before" etc. mean immediately? You use "just" later on, it made me wonder. I assume they do.

Ok, I have one sequence, but have sadly lost interest...it's not you, it's me!
1) No, I did not say I only had ten cookies total. I said there were ten types of cookies. Typically in such boxes you get several of each type. For our purposes let's say 2 each.

2) Good point, but here we will consider coconut not to be a nut.

3) Before and after mean immediately. 

4) No question it is hard work.  I tried and formed one valid sequence too. I didn't really get bored with it, but I have so many other things to do! I guess I'd rather eat cookies than organize them. 

Anyway, here are some virtual cookies for you, as promised. Nice cookie topography.  Maybe you would like to work on a set of equations that describe these cookies next... : )
cookietopography.jpg
 
User avatar
Paul
Posts: 11049
Joined: July 20th, 2001, 3:28 pm

Re: Christmas Cookie Algorithm

December 2nd, 2020, 11:31 pm

Hmm...then why would you say "Two plain" and "Two are filled with or topped with chocolate"?!

I thin k I started with:
If a raspberry jam cookie is eaten just after cookie x, an apricot cookie has to be eaten before cookie x.
And
If I eat one with nuts, a cookie with jam must follow.
 
User avatar
trackstar
Topic Author
Posts: 27805
Joined: August 28th, 2008, 1:53 pm

Re: Christmas Cookie Algorithm

December 2nd, 2020, 11:42 pm

Hmm...then why would you say "Two plain" and "Two are filled with or topped with chocolate"?!

I thin k I started with:
If a raspberry jam cookie is eaten just after cookie x, an apricot cookie has to be eaten before cookie x.
And
If I eat one with nuts, a cookie with jam must follow.
Oh, I see. Lack of specificity.

Well, we can say: two plain - one star shaped and one rectangle.
Two chocolate - one chocolate on it, one chocolate inside it. (kind of did cover that)

I always loved these kinds of questions on GRE tests and the like - although not so enjoyable under time pressure in a room with fluorescent lights...

Still, I may continue to create such brainteasers, at least for my blog.
 
User avatar
trackstar
Topic Author
Posts: 27805
Joined: August 28th, 2008, 1:53 pm

Re: Christmas Cookie Algorithm

December 3rd, 2020, 1:33 am

I thin k I started with:
If a raspberry jam cookie is eaten just after cookie x, an apricot cookie has to be eaten before cookie x.
And
If I eat one with nuts, a cookie with jam must follow.
Yes, those are the building blocks and give two options:

Apricot jam-Nuts-Raspberry jam

or

Nuts-Apricot jam-Cookie X- Raspberry jam

Turns out the designing these is fun too - when I was young I used to make crossword puzzles for my younger sister to solve.

And just to parry your earlier comment - I don't get bored easily, so if I do lose interest, it's not me.... ; )
 
User avatar
trackstar
Topic Author
Posts: 27805
Joined: August 28th, 2008, 1:53 pm

Re: Christmas Cookie Algorithm

December 3rd, 2020, 4:55 pm

Was delighted to find this earlier today:

31 Days of Christmas Cookies - Martha Stewart

Pictures, recipes, and imagine the permutations now - 31!
And I really mean 31!  31*30*29...
Enjoy!

  • Advertisement

ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On