# Tell Wolfram Alpha that a variable is a natural number

How can I tell Wolfram Alpha that some variables are natural numbers, when I want to solve a equation?

An example of what I want to do:

$\binom{n}{k}\cdot p^k \cdot (1-p)^{n-k} = \frac{1}{\sqrt{n\cdot p \cdot (1-p)}}\cdot \frac{1}{\sqrt{2 \cdot \pi}} \cdot e^{-\frac{1}{2} \cdot \left(\frac{x-np}{\sqrt{n \cdot p \cdot (1-p)}}\right)^2}$ solve for $x$ with $n,k \in \mathbb{N}$, $0 \lt p \lt 1$.

• Do you have an example? Commented Oct 31, 2013 at 17:05
• i have the same problem, here's an example @Amzoti : sum_{i=1}^{infinity}(1/2)^i*(1-p)^(i-1) assuming p in ]0,1[ Commented Apr 26, 2017 at 9:04
• This works in wolfram alpha (tested now): > solve (x-3/2)(x-2)=0 over the naturals Commented Apr 16, 2021 at 16:17

Just add an "assuming x integer" at the end. I tested it, and it seems to work. (similar to Maple's notation assuming x::integer, I guess) For natural it doesn't seem to work properly: assuming x natural

• This doesn't seem to work anymore. Commented Oct 10, 2017 at 18:38
• @Skeen Pardon me, but my link seems to work. Funny enough, even assuming x natural works (just click the link) Commented Oct 10, 2017 at 21:20
• I'm getting this: Wolfram|Alpha does not yet know how to respond to your exact query. The "closest interpretation" is based on lexical and semantic similarity in Wolfram|Alpha's computable knowledge space. Commented Oct 11, 2017 at 15:03
• Can you give a link? As I said, I have no problem with the link in my Answer - it simplifies Gamma(x) to (x+1)! using the assumption that x is an integer. Commented Oct 11, 2017 at 16:08

It depends on how you are trying what it is you are trying to solve. Telling Mathematica that something is an integer has a different syntax depending on what you are trying to do.

Assuming that you are using the "Solve" function, it would look like this:

Solve[(x - 3/2) (x - 2)== 0 && x \[Element] Integers]


EDIT. After 6 years, the website has changed and this no longer works. However,

 Solve (x-3/2)(x-2)=0 for x integer


seemed to work, as you can can see here.

• This does not work for wolfram alpha. Commented Aug 15, 2019 at 14:54
• @opa Thank you. After 6 years, the site has changed a lot. Commented Aug 15, 2019 at 15:25
• And how would we specify that all variables in the expression are real? Thank you Commented Nov 12, 2021 at 9:29

As dirty as this is, I've used modulus 1 to force numbers to be integers. Combine with a >= 0 restriction and you can reach Natural numbers.

Example

Solve[ ..., Element[..., Integers]]

• This does not work for wolfram alpha Commented Aug 15, 2019 at 14:54