Assuming the happy paths, where full faith is available:
- Cooldown in hours * democracy effect / duration of effect
- Whereas theocracy effect:
- - 0.8 when active
- - 0.9 when active but occupied
- - 1 if not applicable
For instance, when you have hephaistos, the cooldown is 168 hours and the duration is 24 hours. Let's say you have cooldown enabled:
- 168 * 0.8 / 24
- = 134,4 / 24
- = 5,6
You then round up to the next number, so it would be 6.
For Demeter that would be:
- 216 * 0.8 / 36
- = 172,8 / 36
- = 4.8
So five is the answer you are looking for.
In case you are curious to take it one step further and calculate what the cooldown would be with less temples (or with incomplete faith levels), the calculation is relatively simple:
- Actual cooldown = Total countdown / (sum of island faith levels for wonder / 5) * theocracy effect
- Whereas theocracy effect:
- - 0.8 when active
- - 0.9 when active but occupied
- - 1 if not applicable
Let's take the example Hephaistos. It has 168 hours of cooldown.
Let's say I only have one temple and on that island, maximum faith is available. I do not have theocracy.
Then the calculation would be
- Total cooldown (168) / (5 island levels / 5)
- = 168 / 1
- = 168 hours of cooldown
Let's say I have two temples and theocracy enabled:
- Total cooldown (168) / (10 island levels / 5) * 0.8
- = 168 / 2 * 0.8
- = 84 * 0.8
- = 67.2 hours
You could apply this formula until your cooldown is equal or lower than the duration of the wonder.
For instance, when you have six hephaistos temples and theocracy enabled, the values would be as follows:
- Total cooldown (168) / (30 island levels / 5) * 0.8
- = 168 / 6 * 0.8
- = 28 * 0.8
- = 22.4 hours
Since the cooldown is lower than the duration of the wonder, the cooldown is said to be zero.
The exact same formula works for the other miracles.
To answer your question about demeter:
The effect is 1,5 day and the cooldown is 9 days.
You could do it with five temples if you have theocracy, because:
- 216 h / (25 island levels / 5) * 0.8
- = 216 / 5 * 0.8
- = 43.2 * 0.8
- = 34.56
Which is below the working duration of 36 hours.