One-time passcodes got me thinking about a combinatorics question.In a random 6-digit code, what is the probability that no two digits that are either adjacent or two places apart are equal.So for example:105093 does not satisfy this condition, because there are two 0s two places apart068467 satisfies the condition, because although there are two sixes, they are more than two places apart.I feel like this shouldn't be hard to work out but I am out of practice these days :-(
10 choices for the first digit, 9 for the second, 8 for the third...
>>17090059It's just the size of the set of all sequences where s_n is not the same as s_(n-1) or s_(n+1) or s_(n-2) or s_(n+1) over the space of all 6 digit sequences.
>>17090121>>17090131Ah yeah, so it's 10*9*8*8*8*8 combinations out of 1000000?= about 0.37
>>17090133Stuff like this is usually pretty easy to figure out if you just work number by number sometimes backwards.