The mistake I made was f(x) = f(x+a).

I fix that to f(x) = f(x⊕a) (exclusive or). So there is one entry in the table that will be the same as f(x) rather than repeat the value every “a” step. Sorry for the first mistake. I should not position that as a period finding even though some people may relate Simon’s problem to period finding. (It creates confusion in my context.)