While writing my ‘book’ on music theory it suddenly occurred to me:
Like a die where any pair of opposite sides add up to 7, sharps and flats follow a similar rule.
If you know how many sharps a key has, you can immediately tell the flats of the neighbouring flat key, and vice versa.
D has 2 sharps so Db has 5 flats
Eb has 3 flats so E has 4 sharps
C has zero sharps or flats, so C# has 7 sharps and Cb has 7 flats.