How to halve redstone signal strength?
Solution 1:
What about this? When you make your input two units stronger, your output increases by one.
Edit:
This is rather slow, because it takes up to 8 ticks (one for the last repeater plus one for each of the following comparators) to update the output.
Inspired by Fabian Rölling's faster (only one tick) solution, I found out that lining up the repeater's output to adjacent blocks leads to an even more compact solution for the division by two:
Note that the redstone signal can climb up slabs but not down!
Each repeater is reached in two steps more compared to the previous repeater. The last repeater reached is crucial for the result. Because the output blocks of the repeaters are adjacent, the signal's power is reduced by one for each unused repeater passed.
From this pattern, we can derive solutions for a division by any number, for example by three:
Please note that the input to the repeater can come from behind the adjacent solid block. Here each repeater is reached in three steps more compared to the previous one.
The division by five turns out to be very simple:
Solution 2:
I built a gigantic complex circuit that converted signal strength to time using comparator fadeout and then back to signal strength using locking repeaters, then I built a simpler circuit based on Xisuma's item frame rotation detector, which was still quite bulky and complicated looking… and then I had an epiphany and just used a bit of redstone dust.
This is all. The leftmost redstone dust at the top is the input, the one on the bottom right above the sign is the output. The trick is to just snake around the redstone line more and more the weaker the signal is.
Only the repeater corresponding to the strongest detected signal (furthest to the right) matters for the power level of the output, because for example a power level of 8 overwrites all from 1 to 7 that come from the repeaters further on the left. Only every second repeater is needed in that case, because the other ones would just go to the same line anyway (thanks to Gerhard for that hint). Every pair of initial redstone dusts for two neighbouring repeaters is connected, so that the signal strength decreases by 1 when going to the output from the first pair, but not the second pair. For every pair the redstone line has to snake back and forth one block more than the last one, so that the signal strength at the output decreases by 2 from that.
This should be buildable just from the picture, but here's a structure anyway: https://drive.google.com/file/d/1SPRQaiMwT8hnbWfil-SQXnkWuRb8Iyu5