You have hear it. Flip flops can count. If wired in such a way that Qn toggles 2n times the next Q toggles.
For Example:
If a have 2 FF, then I have two Qs: Q1 and Q2. I also have Clock signal for sure.
So, what happens if I take the enable pins (clock) in a way it toggles Q1 (merge J and K pins for this if using a JK FF) when NGT occurs.
If this happens, Q1 needs to wait for and full transition of clock (0-1) this is:
Now, wire the output Q1 to the clock of Q2. What do we have? Q2 toggles twice slower in terms of NGT than Q1. This is:
So we have the following:
For Qn:
Look at this diagram below and it will explain better than me:
Note that for this system, all J - K pins need to be 1. (for D latches this is 1 for every D pin in every FF)
A circuit involving 2 FF explains elementally what is happening. The counting effect is benefiting from the fact that when you count in binary, each index is toggling (0-1 1-0) according to its index:
| Q4 | Q3 | Q2 | Q1 |
| 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 0 |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 0 | 1 | 1 |
And the table continues...
Here, Q4 needs to toggle each (2^4)/2=8 transitions of Q1, while Q3 needs to toggle each (2^3)/2=4 transitions of Q1 This is basically the same behavour of the FF from above.