There are 2 periodic cicada species in my area. One emerges every 13 years. The other every 17 years. Both are prime numbers, which is interesting but not necessarily related to my question.
I was curious as to how frequently we'd have a year where both, the 13 and 17 year species, emerged during the same year. I created a C# program in LinqPad to find the answer (code and result below, if you are interested), which happens to be once every 221 years.
I mentioned to a co-worker that I would like to know what mathematical formula might describe how to derive that answer. The coworker pointed out "just multiply the two numbers together."
So, my question is why does multiplying the two frequencies together give me the year intervals (221) they coincide? I see that it does, but am not able to visualize why.
List<int> iteration13 = new List<int>();
List<int> iteration17 = new List<int>();
// Pretend they coincide at start of year 2000.
int iStartYear = 2000;
int iEndYear = 3000;
for(int i = iStartYear; i<= iEndYear; i += 13)
{
iteration13.Add(i);
}
for(int i = iStartYear; i<= iEndYear; i += 17)
{
iteration17.Add(i);
}
var intersections = iteration13.Intersect(iteration17);
intersections.Dump("Intersection of 13 and 17 year cicada emergence");
Result:
- 2000
- 2221
- 2442
- 2663
- 2884