Boil the potatoes for 12-15 mins or until tender, then drain and return to the pan over a low heat for 1-2 mins to dry out. Add the butter and mash well. Meanwhile, boil the sprouts for 3-5 mins until just tender. Drain and cool quickly under cold running water. Shake dry, then shred as finely as you can.
Mix the sprouts with the potatoes and season to taste. Leave until cool enough to handle, then shape into 8 round cakes. Tip the flour onto a plate, then coat the cakes, tapping off the excess.
Heat a 5mm depth of oil in a large frying pan and shallow-fry the cakes in 2 batches for 2 mins each side, turning carefully. Drain on kitchen paper and transfer to a baking sheet lined with greaseproof paper. Cool, cover and chill or freeze. Will keep in the fridge for up to 3 days or freeze for up to a month.
Heat oven to 190C/fan 170C/gas 5 (or if you’ve roasted the ham, leave the oven on while it rests) and reheat the cakes for 15 mins until hot through and crisp on the outside.