Processing math: 100%

Monday, April 14, 2025

Paying attention to the hints

Dean has three colors of the hibiscus: red, orange, and yellow. He wants to plant them in a straight hedge of shrubs (each of which is one color) so that the order appears somewhat random, but not truly random. More specifically, he wants the following to be true:

  • No two adjacent shrubs have the same color.
  • No ordering of three consecutive shrubs appears more than once in the hedge.

What is the greatest number of shrubs Dean’s hedge can contain?

I should have picked up on the otherwise extraneous information regarding Rivka Lipkovitz's interest in the base-7 Doomsday algorithm to divine that my Ore's theorem base upper bound was not exactly the sharpest bound in the shed. Well, you can't fool me again! I know that since I did indeed like the previous week's Fiddler involved Hamiltonian cycles, that somehow this one will too ....

So let's design Dean's hedge instructions as a directional graph. Let O denotes an orange hibiscus, R a red one, and Y a yellow one. Then a triplet v=(v1,v2,v3) with vi{O,R,Y} with v2v1 and v3v2 is one of the possible orderings of three consecutive shrubs that satisfies both of the conditions. Let V={ORO,ORY,OYO,OYR,ROR,ROY,RYO,RYR,YOR,YOY,YRO,YRY}

be the set of vertices. We can draw a directional edge between v1 and v2 if the first two characters of v2 are the last two characters of v1, so for instance, there is an edge from RYR to YRO but not one that starts at YRO and ends at RYR. Thus all possible edges are E={(v1,v2)v12=v21,v13=v22}.

Sure enough, there is a Hamiltonian cycle on the graph G=(V,E) covering all 12 possible vertices, which gives a maximal Dean-approved hibiscus hedge length of 14 shurbs (count the first three shrubs of the initial vertex, then each subsequent vertex only adds one new shrub so 3+11=14). One possible instance of this Hamiltonian cylce is given by OROROYOYOYORORYRYOYOYOYRYRYRYRYRORORORO,

which when put altogether gives a hedge denoted as OROYORYOYRYROR.

Monday, April 7, 2025

Striking Ore while digging into Lipkovitz's Hamiltonian puzzle

A teacher is handing out candy to his students. He abides by the following rules:

  • He hands out candy to groups of three students (i.e., “trios”) at a time. Each member of the trio gets one piece of candy.
  • Each unique trio can ask for candy, but that same trio can’t come back for seconds. If students in the trio want more candy, they must return as part of a different trio.
  • When a trio gets candy, the next trio can’t contain any students from that previous trio.

It turns out that every possible trio can get a helping of candy together. What is the smallest class size for which this is possible?

Obviously, I assume that we are not talking about the trivial case of N=3 students, because, ... lame!

So let's assume that there are N>3 students. Then there will be M=(N3)=16N(N1)(N2)

possible trios in the class. Let's assume that the set V={v1,v2,,vM} enumerates all such trios. Based on the teacher's final condition, we can see that if vi and vj share a common student, then vj cannot be the next trio to ask if vi has just received candy. Let's define a set of edges on the vertex set E={(vi,vj)V×Vj>i,vivj=},
that is, if the trio vi could immediately follow the trio vj (or vice versa), then there is an edge between vi and vj. We will call vertices vi and vj adjacent if there is an edge eE connecting vi and vj. Let's define the graph G=(V,E). Note that we define the degree of a vertex, denoted δ(v), to be the number of vertices wV that are adjacent to v, that is, δ(v)=#{wVe=(v,w)E}.

Since it turns out that every possible trio can get a helping of candy together, but based on the second condition each trio can only ask for candy once, then there must be some path that on G that visits each vertex exactly once. This type of path is known in graph theory as a Hamiltonian path. A graph is called Hamiltonian if it admits a Hamiltonian path starts and ends at adjacent vertices. The Norwegian graph theorist Øystein Ore provided the following sufficient condition for a graph to Hamiltonian based on the degrees of its vertices:

Ore's Theorem: A graph G=(V,E) with |V|=n is Hamiltonian if for every pair of non-adjacent vertices v,wV, δ(v)+δ(w)n.

Let's note that for our graph GN, since any vertex v is adjacent to any other trio made up of distinct students, we have δ(v)=(N33)=16(N3)(N4)(N5)=N312N2+47N606.

So from an application of Ore's theorem, whenever M=N33N2+2N62N312N2+47N606
or equivalently, whenever N321N2+92N1200,
then G is Hamiltonian. Since the real root of the polynomial p(t)=t321t2+92t120 is at t15.59.... we have that whenever N16, then every possible trio can have a helping of candy together.