The function $f(n)={3\over2}n+{i^n-i^{-n}\over4i}$ (where $i$ is a square root of minus one) gives the outputs $0,2,3,4,6,8,9,10,\dots$ on being given the inputs $0,1,2,3,4,5,6,7,\dots$.
EDIT: In general, suppose you're given positive intgers $a,b$, and want the output to be all $n$ divisible by one or the other. First find the least common multiple $L$ of $a$ and $b$ (in the example, $L=6$). Then find the number $N$ of multiples of $a$ and/or $b$ in $0,1,2,\dots,L-1$ (in our example, $N=4$; in general, this is a simple exercise). The main term of $f(n)$ will be $(L/N)n$. The difference, $f(n)-(L/N)n$, will be periodic with period $N$, so it will be a linear combination of the functions $g_j(n)=e^{2\pi ijn/N}$, $j=0,1,\dots,N-1$. You find the coefficients in this linear combination by the standard techniques of intro linear algebra - it's just solving $N$ linear equations in $N$ unknowns.