How to build a triple flip-flop?

enter image description here

Two sticky pistons pulsed simultaneously with 1-tick pulse (like from an observer or a monostable) handing a redstone block to each other. The two comparators on the sides could be replaced with repeaters, but the middle one is needed to filter out the moment the redstone block transitions back from one side to the other stopping just for 1 tick.

Obviously this only works in Java Edition.


This circuit can be used to get an output every 1, 2, 3, … up to 320 inputs, depending on how many items you put into the dropper:

The dropper points into the hopper and the hopper into the dropper.
Here is a structure file: https://drive.google.com/file/d/1471ikFq5PrcBcpdfpolioXI3gfxvwt3t

This circuit is actually much more complex than it looks:
When you press the button, the comparator receives a signal strength of 15 from the button, which is higher than whatever it gets from measuring the dropper, so its effective input signal strength is 15. Note that this might change in the next snapshot, because this report is marked as "fixed" in 20w11a, even though I am pretty sure that it reports an intended game mechanic. I don't know how it's supposed to be "fixed" in the next snapshot.
The input signal strength of 15 is equal to the side signal strength of 15, which means that the comparator turns on its output. That turns off the redstone torch and redstone wire in the bottom of the picture.
The button also activates the dropper, which drops one item into the hopper.
The comparator also turns on the redstone dust in the top of the picture and the repeater, which locks the hopper. When the button turns off, the comparator outputs a power level of at most 8, which is still enough to lock the hopper, so the item that got dropped into it does not get pushed back.

When you press the button a second time, the comparator shortly outputs a signal strength of 15, then goes back to whatever it measures from the dropper. Not much happens in the rest of the circuit.

When you have pressed the button as many times as there were items in the dropper, the comparator shortly outputs a signal strength of 15, then 0. That turns on the redstone torch and bottom redstone wire and turns off the top redstone wire and repeater. The hopper gets unlocked and pushes back all its items into the dropper. The comparator does not activate from that, because the comparator still gets a side input signal of strength 15. That way, the circuit is back to the state in the screenshot.


You can take an output signal from any component of this circuit (except the button) and invert and/or shorten it, if you need that.

This circuit has a size of 4×2×3, not counting the button, which can be any input (or a button on the side of the block).
In theory you should be able to remove the column with the repeater and button, move the right column one to the left and put the button on the dropper, but for some reason the comparator does not receive the signal from the button. That is probably a bug, but I will wait until 20w11a is out before I report it.

You need 2 redstone, 1 repeater, 1 comparator, 1 redstone torch, 1 dropper, 1 hopper and 7 blocks, of which the higher 3 need to be solid, the other just need to have a solid top surface. You also need items inside the dropper.
The button can be replaced with any input downwards, upwards or from the one remaining side into the block, as long as it powers the dropper and comparator from there.
Any input length should work, but if you use only one item in the dropper (which would make the circuit useless, but do whatever you like) and toggle the input very fast many times, the redstone torch can burn out. That should only delay putting back the items from the hopper to the dropper, but if you give more inputs into the circuit in the meantime, that might break something, if you depend a lot on outputting on every input.
No input speed (of on/off cycles) completely breaks the circuit (except for the case mentioned above), but if the off phase after the last input is less than 3 redstone ticks times the number of items, then the hopper cannot put the items back into the dropper in time, so you do not get the wanted output.

The delay from input to output is one tick, if you take an output from the block on the right or the redstone wire on top.


enter image description here enter image description here

This is both fairly fast, and quite safe to stay unchanged, plus will work in BE as well. One item in a hopper-dropper loop. Positive edge ejects the item switching the signal off, negative edge activates next one. If you prefer this reversed you can attach outputs to hoppers, and in this case using a non-stackable item you'll be getting signal strength 3, meaning in many cases you can omit the repeaters, increasing reaction speed. You still need to allow enough time for the comparator to grab the signal.


I found a much better solution than in my previous answer, much better than all of the existing answers even (in my opinion). And what gave me the idea for it was a video about astrophysics: https://www.youtube.com/watch?v=F1CddzgVW14

Whenever you have a problem and want to solve it with redstone, it's always a good idea to try an Etho hopper clock. They are insanely versatile.

The right part of this circuit is just an Etho hopper clock, with an inverted output coming from both pieces of redstone dust. The left part is just a generator for quick off pulses, leading into both hoppers.
Whenever you press one of those many buttons (doesn't matter which one), one item goes from one hopper to the other. If you for example put 3 items in, then every 3 button presses, one of the lamps will light up. You can just combine those two outputs into one to get an output on every third input. Alternatively, you can just use only one of them to get an output on every sixth input, which works better, but only for even numbers.

Here is the structure file: https://drive.google.com/file/d/1YM_EyIYJZupriuereG3I5lf7b30nzcAM

This circuit has no reset time and a delay of 5 redstone ticks (10 game ticks), which could be rewired for just 3 redstone ticks/6 game ticks delay.

Turning the input on and off very quickly many times would make the torch burn out.

The circuit has a size of 5×3×6, but it can also be rewired easily to be 3×3×6 or even 6×2×6, of which the bottom of the two layers is just the ground.
The materials in the screenshot are 4 solid blocks, 7 more blocks with a solid top surface, 5 redstone, 3 redstone torches, 3 repeaters, 2 comparators, 2 sticky pistons, 1 redstone block, 2 redstone lamps and 2 hoppers (with 3 items inside) and some buttons. Of course much of this changes if you rewire some parts, this can change a lot.

This circuit can be used every number of input pulses per output pulse from 1 to 320 and every even number from there to 640. And of course you can combine multiple of these for bigger numbers.