(Warning: lots of unstated approximations in the following answer. Good enough for government work, not good at all for actually pointing a telescope.)
There is no simple formula for three or more celestial bodies; in fact, while two celestial bodies are (almost, barring unnatural situations) guaranteed to align perfectly from time to time, three or more are not guaranteed to align perfectly, ever; and they usually don't, so that you must decide how closely aligned they should be for you to consider their position a good enough conjunction.
For example, consider Io, Europa, and Ganymede, three of the Galilean moons of Jupiter: their orbits are in a 4:2:1 resonance, and they never ever align perfectly.
So in the end, it all depends on:
- The synodic orbital periods of the celestial bodies.
- Their starting positions in the sky.
- What you consider a good enough conjuction. Perfect conjuctions may be impossible, but you may settle for an imperfect conjuction.
First, let's establish a little terminology.
The "orbital period" of a satellite can be considered from two different points of view:
If the orbital period is considered from the point of view of the fixed stars, then it is called "sidereal period".
If the orbital period is considered from the point of view of an observer on the planet's surface, then it is called "synodic period".
They are different, because during the time the satellite completes a sidereal orbit, the planet below it has rotated a little, so that it won't appear in the same position in the sky for the observer on the surface. As an extreme example, consider a geostationary satellite used for telecommunications: its sidereal period is 24 hours, while its synodic period is infinitely long.
So the first thing to do is to determine the synodic periods of the five moons. If you know the sidereal periods, add or subtract the fraction of planetary rotation completed in a sidereal period, depending on whether the satellite orbits the planet in a prograde or retrograde direction.
At this point you have:
- The synodic periods of the five moons, either given or computed.
- Their initial positions in the sky, which must be given.
Now it is only a matter of tracking their positions in the sky, and stopping when you find them covering a small enough angle for them to be considered in conjuction. You can do it in a simple program, or in a spreadsheet.
For example, assigning the following synodic orbital periods to the satellites: 0.5, 0.7, 0.9, 1.1, 1.3 and 6 days; and assigning the following starting positions (degrees counterclockwise with North = 0): 0, 60, 120, 180, 300: they will come within a sector of 36.3 degrees after 901.58 days, and will again be within 35.3 degrees 901.04 days later; the next such close alignment will be 1638 days later, when they will come within 35.3 degrees. Those may be or may not be good enough conjuctions, that's your choice.
Cheating a little
If you know the synodic orbital periods of the satellites, you can compute their least common multiple with any desired precision.
For example, continuing the example of the six satellites with synodical periods of 0.5, 0.7, 0.9, 1.1, 1.3 and 6 days: it is obvious that their position in the sky will repeat every 18,018 days; so that if right now they are in good enough conjunction, they will also be in good enough conjunction 18,018 days later. (This does not mean that there won't be other good enough conjunctions during those 18,018 days.)