In our office, we buy Royal Mail stamps in ready to use denominations of "1st Class", "2nd Class", "Large 1st Class" and "Large 2nd Class". However, these are only useful for 100g weight letters.
For heavy letters, we can use multiples of these stamps. I noticed I was routinely having to do the calculation in my head as to what is the optimum combination of stamps. For example, what to stick on a 500g 2nd class large letter. I know that's £1.58, I know the stamps represent the 100g values, so 1st=65p 2nd=56p Large_1st=98p and Large_2nd=76p.
It's not too hard to work out, but it takes time and gets harder with bigger letters and parcels.
For a coding challenge, I wrote "Stampulator". It's a single web page that tells us which combinations of stamps to use, so for the 500g 2nd Class large letter, £1.58 example, we need 1 x 1st class and 1x Large 1st class. That's over by 5p, but it's the nearest value to the cost.
I also made it so that if I have different value stamps or a different target value to reach (say; special offer or I've been slow to update the values when Royal Mail prices change) I can input those and get an instant result.
I then printed the page and stuck it buy our post box. Stampulator is on my web server and free to use - it works well from a mobile phone too.
Post a comment here if it's useful and that'll encourage me to keep it up to date.