user15359: Basically I want one LED to flash 5 times in the same amount of time it takes another LED to flash 4 times. This is what I have, but they are flashing independently and I need them to flash simultaneously. 
//Making a 5/4 Polyrhythm with 2 LEDs
const int LED13 = 13;
const int LED7 = 7;
int i = 5; 

void setup() {
   pinMode(LED13, OUTPUT);
   pinMode(LED7, OUTPUT);
}

void loop() {

  for(i=0; i<5; i++)
  {
     digitalWrite (LED13, HIGH);
     delay(500);
     digitalWrite (LED13, LOW);
     delay(800);
  }

  for(i=0; i<4; i++)
  {
     digitalWrite (LED7, HIGH);
     delay(500);
     digitalWrite (LED7, LOW);
     delay(1000);
  }

}

user6628: See https://arduino.stackexchange.com/a/17929/6628 with code like:
const int onTime = 500;
const int measureTime = (int) (60*1000/10);  // 10 BPM, or 1500*4ms/measure
const int off4 = measureTime/4 - onTime;  // take care these don't go negative
const int off5 = measureTime/5 - onTime;  //
unsigned long next5;
unsigned long next4;


...
loop(){
  unsigned long now;
  now=millis();
  ...
  if(next5 < now) {
     if digitalRead(LED13) { next5 = now+off5;   digitalWrite(LED13,LOW );}
     else                  { next5 = now+onTime; digitalWrite(LED13,HIGH);}
  }
  if(next4 < now) {
     if digitalRead(LED7)  { next4 = now+off4;    digitalWrite(LED7,LOW );}
     else                  { next4 = now+onTime ; digitalWrite(LED7,HIGH);}
  }

}


user2881: I generally calculate whether the led must be on or off, based on the current time.
//Making a 5/4 Polyrythm with 2 LEDs
const int LED13 = 13;
const int LED7 = 7;
int i = 5; 

void setup() {
   pinMode(LED13, OUTPUT);
   pinMode(LED7, OUTPUT);
}

void loop() {
    // led 13 flashes 5 times per interval of 6 seconds. So the led is on/off for 600ms ( 6000/(2*5) )
    // led  7 flashes 4 times per interval of 6 seconds. So the led is on/off for 750ms ( 6000/(2*4) )
    bool led13on = (millis()/600)%2!=0; // count the number of 600ms intevals have passed, and see if this number if odd or even. odd means led must be on, even means the led must be on
    bool led7on  = (millis()/750)%2!=0;
    digitalWrite (LED13, led13on);
    digitalWrite (LED7, led7on);
    delay(10);
}


15359: <p>Basically I want one LED to flash 5 times in the same amount of time it takes another LED to flash 4 times. This is what I have, but they are flashing independently and I need them to flash simultaneously. </p>

<pre class="lang-c prettyprint-override"><code>//Making a 5/4 Polyrhythm with 2 LEDs
const int LED13 = 13;
const int LED7 = 7;
int i = 5; 

void setup() {
   pinMode(LED13, OUTPUT);
   pinMode(LED7, OUTPUT);
}

void loop() {

  for(i=0; i&lt;5; i++)
  {
     digitalWrite (LED13, HIGH);
     delay(500);
     digitalWrite (LED13, LOW);
     delay(800);
  }

  for(i=0; i&lt;4; i++)
  {
     digitalWrite (LED7, HIGH);
     delay(500);
     digitalWrite (LED7, LOW);
     delay(1000);
  }
</code></pre>

<p>}</p>
 6628: <p>See <a href="https://arduino.stackexchange.com/a/17929/6628">https://arduino.stackexchange.com/a/17929/6628</a> with code like:</p>

<pre><code>const int onTime = 500;
const int measureTime = (int) (60*1000/10);  // 10 BPM, or 1500*4ms/measure
const int off4 = measureTime/4 - onTime;  // take care these don't go negative
const int off5 = measureTime/5 - onTime;  //
unsigned long next5;
unsigned long next4;


...
loop(){
  unsigned long now;
  now=millis();
  ...
  if(next5 &lt; now) {
     if digitalRead(LED13) { next5 = now+off5;   digitalWrite(LED13,LOW );}
     else                  { next5 = now+onTime; digitalWrite(LED13,HIGH);}
  }
  if(next4 &lt; now) {
     if digitalRead(LED7)  { next4 = now+off4;    digitalWrite(LED7,LOW );}
     else                  { next4 = now+onTime ; digitalWrite(LED7,HIGH);}
  }

}
</code></pre>
 2881: <p>I generally calculate whether the led must be on or off, based on the current time.</p>

<pre><code>//Making a 5/4 Polyrythm with 2 LEDs
const int LED13 = 13;
const int LED7 = 7;
int i = 5; 

void setup() {
   pinMode(LED13, OUTPUT);
   pinMode(LED7, OUTPUT);
}

void loop() {
    // led 13 flashes 5 times per interval of 6 seconds. So the led is on/off for 600ms ( 6000/(2*5) )
    // led  7 flashes 4 times per interval of 6 seconds. So the led is on/off for 750ms ( 6000/(2*4) )
    bool led13on = (millis()/600)%2!=0; // count the number of 600ms intevals have passed, and see if this number if odd or even. odd means led must be on, even means the led must be on
    bool led7on  = (millis()/750)%2!=0;
    digitalWrite (LED13, led13on);
    digitalWrite (LED7, led7on);
    delay(10);
}
</code></pre>
