Answer: Ok, so you have 8 white notes and 5 black.
You want to write an 8 note melody, with te only restriction that you need to alternate the colors.
so if we start with the white keys you have
8 possibilities, then 5, then 8, then five, and so on.
so you have
and also you can start with a black key, that will give you the same amount of combinations.
so total number is 2*
= 512000