> I agree with this criticism, so I replaced the program:

That makes more sense, but I still don't understand the expression

a % ((cc % b)+1) == 0

If I change it to something that would make sense to me, I get vastly different results:

for a in range(2,24):
total = 0
for b in range(1,30):
for c in range(1,1000):
cc = c + start_offset
cicada_hatch = (cc % a == 0)
predators_hatch = (cc % b == 0)
if cicada_hatch and predators_hatch:
total += 1
print ' %2d = %6d %s' % (a,total, '*' * (total/320))

But now the fast cycles get large bars. What we want to know is how often the cicada mate vs how often they are eaten: (written overly verbosely to make sure it's readable)

for a in range(2,24):
total_cicada_hatchings = 0
total_predator_feasts = 0
for b in range(1,30):
for c in range(1,1000):
cc = c + start_offset
cicada_hatch = (cc % a == 0)
predators_hatch = (cc % b == 0)
if cicada_hatch:
total_cicada_hatchings += 1
if cicada_hatch and predators_hatch:
total_predator_feasts += 1
efficiency = float(total_cicada_hatchings) / float(total_predator_feasts)
print ' %2d = %6d %s' % (a,efficiency, '*' * int(efficiency * 5))

With this code indeed the prime numbers show up. But this code has the problem I described: both the predator cycle and the cicada cycle start synchronized. Here is the fix:

initial_cicada_cycle_year = 1 # arbitrary number
initial_predator_cycle_year = 0 # another arbitrary number

for a in range(2,24):
total_cicada_hatchings = 0
total_predator_feasts = 0
for b in range(1,30):
# cicada_cycle_year will have a value in the range {0..a-1}
cicada_cycle_year = initial_cicada_cycle_year % a
# predator_cycle_year will have a value in the range {0..b-1}
predator_cycle_year = initial_predator_cycle_year % b
for c in range(1,1000):
cicada_hatch = cicada_cycle_year == 0
predators_hatch = predator_cycle_year == 0
if cicada_hatch:
total_cicada_hatchings += 1
if cicada_hatch and predators_hatch:
total_predator_feasts += 1
# move the cycle forward by 1 year
cicada_cycle_year = (cicada_cycle_year + 1) % a
predator_cycle_year = (predator_cycle_year + 1) % b
efficiency = float(total_cicada_hatchings) / float(total_predator_feasts)
print ' %2d = %6d %s' % (a,efficiency, '*' * int(efficiency * 5))

If you set initial_cicada_cycle_year equal to initial_predator_cycle_year then you'll get the prime numbers to show up. Otherwise you get something else.

> The reason is that what's being measured is the number of collisions between a particular predator reproductive cycle over time, and a valid result merits a long time (I usually use 1000 years). This fact prevents the starting point from influencing the outcome.

Suppose that the predator cycle is 3 and the cicada cycle is 3. Then if at year 0 the cycles coincide, they will in the future coincide every 3 years because you have this pattern:

year 0123456789 ...
cicada X X X X ...
predator X X X X ...

If at the start year 0 the cycles do not coincide, they will never coincide in the future, no matter for how many years you run the simulation:

year 0123456789 ...
cicada X X X X ...
predator X X X ...

So the starting offset between the cycles is highly important!

> including a valiant effort by psychologists and fans of psychology to delete my Wikipedia page (an effort that will eventually probably succeed)

Haha that is so funny...and sad. Also my apologies for the tone in my original post. The reference to psychology was unnecessary and mean..