# Expression that hits integer multiples of two variables

Is there a way to generate am expression that will get all integer multiples of an arbitrary pair of integers?

I.e. Some function that will spit out ${0,2,3,4,6,8,9,10, ... }$ and all of the other multiples of 2 and 3 given integer arguments. It should not generate results for integer arguments that are not multiples of 2 and 3.

By function I mean using elementary mathematical operations.

I would prefer a single variable expression.

-
I'm confused. Your $f(x,y)$ outputs many more integers than the multiples of a and b. But if that's allowed, then just take your single-variable function to be $f(x)=x$, and then you get all your multiples out. – Cam McLeman Jan 29 '12 at 15:25
Does $$f(n)=\text{the }n\text{th natural number that is a multiple of either }a\text{ or }b\text{ (or both)}$$ count for you? If not, then you'll have to specify more precisely what you mean by "function". – Henning Makholm Jan 29 '12 at 15:25
@CamMcLeman, Henning, edited, you are correct. – soandos Jan 29 '12 at 15:30
So what you want is not just a function (which in mathematics can be just about anything you are able to define unambiguously), but an expression with one or more free variables. But then you need to specify what is an "elementary mathematical operation" to you. – Henning Makholm Jan 29 '12 at 15:32
Standard definition, composition of constants, logarithms, exponentiation, extractions of nth roots by using $(+,-,*,/)$. – soandos Jan 29 '12 at 15:34

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.