2
$\begingroup$

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.

  • 0
    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.2012-01-29
  • 2
    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".2012-01-29
  • 0
    @CamMcLeman, Henning, edited, you are correct.2012-01-29
  • 0
    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.2012-01-29
  • 0
    Standard definition, composition of constants, logarithms, exponentiation, extractions of nth roots by using $(+,-,*,/)$.2012-01-29
  • 0
    The point is there _is no standard definition_ of "elementary operation". One has to specify explicitly in each case what one allows. For example in formal number theory the "monus" operation $(x,y)\mapsto\max(0,x-y)$ is considered more elementary than some of the ones you quote.2012-01-29
  • 0
    Apologies, I meant elementary functions (seen the term in several places, and saw more [here](http://en.wikipedia.org/wiki/Elementary_function))2012-01-29
  • 0
    if $b > a$ and $\gcd(a,b)=a$ then $f(x)= a \cdot x$2012-01-29
  • 0
    Not seeing how to get the second set of multiples from that...2012-01-29
  • 0
    In pedja's setup, multiples of b *are* multiples of a.2012-01-29
  • 0
    Then it does not work for arbitrary $a$ and $b$2012-01-29

1 Answers 1

3

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.

  • 0
    How could I generalize this for arbitrary multiples?2012-01-29