# What is a single-prime function other than $f(x)=x!$?

[Noob warning]: I am not a mathematician. If you use jargon, please explain or reference.

Other than $f(x)=x!$, what is a univariate non-piecewise function with a domain that is either all integers, or an infinite-sized subset of all integers, and whose range contains only integers and exactly one prime number?

For those that prefer lists, here are the criteria again:

• Univariate (one independent variable)
• Not $f(x)=x!$ (of which I 'think' meets the criteria below...)
• Non-piecewise (non-hybrid)
• Domain is either all integers or an infinite-sized subset of all integers
• Range contains only integers
• Range contains exactly one prime number
• How is $x!$ bivariate? Feb 17, 2016 at 2:59
• $f(x)$ is univariate. Feb 17, 2016 at 2:59
• How do you feel about constant functions? Feb 17, 2016 at 2:59
• How about $f:\Bbb N\rightarrow\Bbb N$ given by $f(n)=p^n$ for $p$ a fixed prime. Feb 17, 2016 at 3:04
• Even more simply than most of those given: $f(x) = px$ (or $p\cdot(x+1)$, depending on how you feel about zero and where you want to start counting). There are a bunch of problems with this question: (1) there are many many such functions (in fact, $f(x) = p\cdot g(x)$ for any $g$ that's 1 somewhere and $\gt 1$ everywhere else - e.g., $g(x) = 1+(x-n)^2$ for any $n$ - also works); (2) 'non-piecewise' turns out to be a very artificial restriction to impose on functions; and (3) there's no motivation for this question - why do you want such a thing? Feb 17, 2016 at 3:21

How about $f:\Bbb N\rightarrow\Bbb N$ given by $f(n)=p^n$ for $p$ a fixed prime.

• Or $p^{n^2}$ if you want the domain to be all of $\mathbb{Z}$. Feb 17, 2016 at 18:22

Your example $f(x) = x!$ is $f_1$ in the following sequence of functions that meet your requirements (with $f_n(2) = 2$ being the only prime in the range of $f_n$):

$$f_n(x) = \frac{(x!)^n}{2^{n-1}}$$

$$f(x)=x^2+x$$ More generally, if $g(x)$ is any function with $f(1)=p$ is prime and $f(x) \geq 2$ for all $x$ then $$f(x)=xg(x)$$

Also $$h(n)= lcm [1,2,3,..,n]$$

Also $$u(n)=n^{n-1}$$

$x^{x-1}$ for $x \ge 2$.

More generally, for any prime $p$, $x^{x-p+1}$ for $x \ge p$.

$f(n)= (n-1) \cdot( n^2-1 \mod 4)$

$f(x)=x$ with a domain of "all composite integers together with 11".

$f(x)=7$

$f(x)=x^2-x$

• this answer does not really explain the "jargon" in the question, please improve (this answer was flagged as being low quality and I was reviewing low quality posts) Feb 17, 2016 at 18:44