The Carpet of Eden

Problem

To calculate theoretic populations of fleas, breeding under ideal environmental conditions (humidity, temperature, shag pile, vibration, hosts), after introducing Adam and Eve into your Carpet of Eden at day zero.

Hope

  • Pet owners begin to understand that when fleas enter your home, time is of the essence. Delayed detection of an early infestation can result in a massive egg bank.
  • Once a population is established you may need to use a flea product for  several months before you start to see an improvement, as you gradually kill off the egg bank. If your chosen insecticide doesn’t seem to be working, consider the possibility that you’re killing them as fast as they hatch.
  • If you are going to stop your flea protection over winter, especially in warmer climates, get a flea comb and detect the spring flush early!

Assumptions

Each female produces 500 eggs in a lifetime, at a rate of 40/day, then dies at one month. Generation interval (from lay to next generation producing eggs) is 28 days.

Populations for first 100 days (5% adults, 95% immature)

At 10 days, there’s 402                     (2 parents, 400 immature forms)
At 20 days, there’s 442                     (owner notices dog is itching)
At 30 days, there’s 2,842                  (2 parents, 80 2nd gen, 2762 immature)
At 40 days, there’s 62,040                (owner buys flea collar)
At 50 days, there’s 106,040              (owner waiting for collar to start working)
At 60 days, there’s 426,040              (yes, almost half a million in 2 months)
At 70 days, there’s 8,777,960           (flea dermatitis develops, start spot-on)
At 80 days, there’s 22,809,600        (owner complains: spot-on doesn’t work)
At 90 days, there’s 65,769,600        (owner vacates the property)
At 100 days, there’s 1,209,761,200

Flea population after introducing single breeding pair at day 0

Flea population after introducing single breeding pair at day 0

C++ script:

/*
females produce 40 eggs a day for 12 days and 20 egss on 13th day
half of the eggs are female

eggs take 28 days to reach maturity

life after birth is 4 weeks
*/
// population.cpp

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

#define MAX 68

void intro() {
printf (“This program will list out the number of fleas that there are.\n”);
printf (“They start production on day 28 and go to day 39.\n”);
printf (“At that point, they have produced 500 eggs.\n”);
}

void kill (long int *p) {
int i; // used in for loop
//  for (i=0; i<MAX; i++)
//printf (“%9.4f”, rand())
//    p[i] = rand()*p[i];
}

int upper (char ch) {
if (ch >= ‘a’ && ch <= ‘z’) ch = ch – 32;
return (ch);
}

void help () {
printf (“\nAssistance for the program\n\n”);
printf (” I list individuals\n”);
printf (” P print out\n”);
printf (” U update\n”);
printf (” Q quit\n\n”);
printf (” Choice? “);
}

void list (long int *p) {
int i; // used in for loop

for (i=0; i<MAX; i++) {
printf (” %3d:%9ld”, i, 2*p[i]);
if ((i + 1) % 5 == 0)
printf (“\n”);
}
printf (“\n”);
}

long int out (long int *p) {
int i; // used in for loop
long int sum=0; // population sum

for (i=0; i<MAX; i++)  sum += p[i];

return (sum);
}

long int update (long int *p) {
int i;
long int sum=0;

for (i=MAX-1; i>0; i–) {
p[i] = p[i-1];
sum += p[i];
}

p[0] = 0;   // account for new born fleas
for (i=28; i<40; i++)
p[0] += 20*p[i];
sum += p[0];
return (sum);
}

void main() {
int i; // used in for loop
int ch; // command for program to do
int d=0; // number of days
long int p[MAX];      // used for population
long int pop; // the population

intro ();
// initialize the population
for (i=0; i<MAX; i++)  p[i] = 0;
p[28] = 1; // start with one mature
pop = 1;

help();
ch =upper(getch());
if (ch != ‘Q’)
do {
printf (“ch %c\n”, ch);

if (ch == ‘U’) {
d++; // add one to number of days
printf (“The number of days is %d.\n”, d);
}

if (ch == ‘H’) help();
else if (ch == ‘I’) list (p);
else if (ch == ‘P’) printf (“The total is %ld\n”, pop = 2*out(p));
else if (ch == ‘O’) kill (p);
else if (ch == ‘U’) printf (“Another day passed.  Now there are %ld fleas.\n”, pop = 2*update(p));
else if (ch != ‘Q’) help();

if (pop < 0)  for (i=0; i<MAX; i++)  p[i] = 0;   // if population goes negative, eliminate all

help();
ch = upper(getch());
}
while (ch != ‘Q’);
else printf (“Boy, you killed them before they got started!\n\n”);

if (d > 0) printf (“And that exterminated the fleas …\n\n”);

Acknowledgment

While able to calculate for the first month, beyond day 30 my head started to hurt. Within 2 days Scott A Wilson, at allexperts.com, had written the code and resolved the matter.  Thanks scottie.

.

Tags: , , , ,

Leave a Reply