Flagging

How many tricolour flags are possible with 5 available colours such that two adjacent stripes must NOT be the same colour. What about 256 colours?

Problem

How many tricolour flags are possible with 5 available colours such that two adjacent stripes must NOT be the same colour. What about 256 colours?

Image
Flagging

<-- Here's an example for 3 colours.