I'm surprised you figured this out, I'm having trouble grasping
Surprised?
I'm surprised you have so little faith in me
The first half, before the plus sign, accounts for any time that:
-The middle number is 0, 1, or 8, as they all flip to themselves. No other numbers do, so any other number there becomes a different zip-code or invalid. The ones that become different zip-codes are already accounted for by the 1250 I mention earlier in my post. In that part, I use 5x5x2x5x5 iirc. That accounts for EVERYTHING that is all flippable numbers and has 6 or 9 in the middle. The other numbers could also be 6 or 9 or 8, it doesn't matter, they flip to something different regardless. Once we had that 1250 with 6 or 9 in the middle out of the way, we only had to focus on the last 3 remaining numbers for the middle digit.
-The first and the last number are different. This would automatically cause the zip-code to change when flipped regardless of the other digits. The way it cuts out overlap is that the 2nd and 4th digits could flip to be different, the 1st and 5th digits could flip to be different, or both could flip to be different. Since this covers any scenario where the first and fifth are different, including any combination of the 2nd and 4th digits, we have to cut out the overlap.
So, the second half, after the plus sign:
-Accounts for any remaining numbers. Since the first half accounts for anytime the first and last digits flip to each other, this half has to account for any time that they DON'T but still become a different valid zip-code. So, for each digit, there's only one that it can flip to, so the first is can be any of the 5 and the last has to be that same one, meaning there's only one option at any one time. Obviously the middle digit has to be 1, 8, or 0, since we already accounted for numbers having 6 or 9 in the middle regardless of what the other numbers were. So that's where the first 5, the 3, and the 1 come from. The second digit can be any of the 5, and since we're accounting here for any time the 2nd and 4th digits flip to be different, the 4th digit can be anything BUT the same as the 2nd digit, meaning for any given digit, there would be 4 other options.