Frequency divider circuit of a factor of arbitrary number
Use added logic to capture counts as they appear at the binary counters outputs. The LSB is 1 if high. The weight of the bits is 1, 2, 4, 8 for a 4 bit counter. A count of 9 means 1 and 8 are high, 2 and 4 are low. Use and or nand gates on these pins to reset the counter each time it has a count of 9, or a count of 8 if asynchronous reset, as 0 is part of the count.
As long as the clock pulse is running it will repeat the same  count endlessly.
Because 0 is part of the count,  the counter will have one more state then the counters value.