Combinatorics, Automata and Number Theory