Are "sum" and "product" defined when there is only one number? I solved a math problem on an online judge site recently.  The question specified that the answer should be for an input number N, the smallest non-negative number Q so that the product of the digits of Q exactly equal N.
The answer for inputs 1 through 9 are 1 through 9, respectively.   However, this offends my sense that a "product" must have two or more "factors".   To me, the answers for 1 through 9 should be 11 through 19 -- it takes two factors to produce a product.
I'll note that this sense does not extend to sum, I'd have no issue saying that the sum of the digits in the number 3 is 3, which I'll readily admit isn't being self consistent.
It is mathematically rigorous to say that "the sum/product of a set of numbers" is defined for when there is just one number, and that the answer is that number?
 A: The short answer is "Yes".
We can define multiplication $a\cdot b$ as an $a$ long sum of $b$'s. Think of objects alligned in a rectangle, the way you're taught in elementary school. What then would the product $1\cdot5$ mean? It would be the total sum of one $5$. For multiplication, the same argument can be made with $5^1$. But it gets better.
What is the sum of no numbers? That's easy to calculate, $0\cdot b= 0$. But how do you make sense of that? Imagine having a box full of numbers, and a display on the lid of the box what the sum of those numbers are. Then take them out, one by one, and see how the display changes. The intuitive consequence is that when you remove the last number from the box, the display should read "0".
What then, of the product of 0 numbers? Imagine a calculator with a number pad, a clear-button, an enter-button and a one-line display. It has one number stored, and you can type in another number. As long as you're not typing, the stored number is shown on the display. When you press the "enter"-button, the calculator multiplies the typed number wiht the stored number, stores the result, and displays it. When you press "clear", you would intuitively have a product of no numbers stored, and the only number to store that makes the calculator work is 1. So the empty product is 1. You see it in math as for instance $5^0$, and $0!$.
A: You would probably agree that
$$
\sum\limits_{n=1}^Nx_n=x_N+\sum\limits_{n=1}^{N-1}x_n\quad\text{and}\quad \prod\limits_{n=1}^Nx_n=x_N\cdot\prod\limits_{n=1}^{N-1}x_n.
$$ Try $N=2$ in these formulas and identify 
$$
\sum\limits_{n=1}^{1}x_n\quad\text{and}\quad\prod\limits_{n=1}^{1}x_n.
$$
By the same argument, any sum of zero terms is $0$ and any product of zero terms is $1$.
A: A function should be defined for as many inputs as it can consistently be defined for. Defining product(x) => x is perfectly consistent with all the rules of multiplication, so defining it thus can only improve the expressiveness of mathematical statements.
A: Actually when you define the sum and the product, you initially define it for exactly two numbers. Not more, not less. Then you notice that addition and multiplication are associative, so it doesn't matter if you first add $a$ and $b$, and then add $c$ to the result, or of you first add $b$ and $c$, and then add that to $a$. Therefore you can easily extend that definition to three or more summands, by using a recursion: $a_1+\ldots+a_n = (a_1+\ldots+a_{n-1})+a_n$. This way, you have defined the sum for any number of at least two summands.
But then, the restriction seems quite arbitrary, so can we extend the definition to just one summand? Well, we can, because the obvious condition is that the recursion rule still holds, that is $(\text{the sum of $a_1$})+a_2 = a_1 + a_2$, which of course for given $a_1$ has to hold for all values of $a_2$. There's exactly one solution to this equation, namely $(\text{the sum of $a_1$})=a_1$.
We can go even further and ask if we can define the sum of no numbers. And indeed, we can: Our recursion now reads $(\text{the sum of no numbers})+a_1 = a_1$, which of course immediately implies $(\text{the sum of no numbers})=0$.
The same construction can be done with the product of course, and we again get $(\text{the product of $a_1$})=a_1$, and then $(\text{the product of no numbers})=1$.
Another way to make sense of sums of no or just one number, imagine a set of disjunct finite sets (that is, each set has only finitely many elements, and no two sets have the same elements), and then ask how many elements there are totally (mathematically: how many elements the union of those sets has). Of course, since the sets are disjunct, the total number of elements is the sum of the numbers of elements in the sets. But what if there is only one set? Well, in that case, the total number of elements is just the number of elements in that set! Thus the sum of just one number is that number. And finally, what if there are no sets at all? Well, if there are no sets, there are no elements, therefore the sum of no numbers is $0$.
To do the same argument for multiplication, ask how many different sets there are which have exactly one element from each of the sets, and nothing else. You'll find that this is just the product of the sizes of the sets (e.g. if you have the sets $\{a,b\}$ and $\{1,2,3\}$ you'll get the 6 sets $\{a,1\}$, $\{a,2\}$, $\{a,3\}$, $\{b,1\}$, $\{b,2\}$ and $\{b,3\}$). But what if you have only one set? Well, then of course you'll get one set for each element of that set, so the number of sets you get is the number of elements in the set, that is, the product of one number it the number itself. And if you start with no set to begin with? Well, the only set which has no element from another set is the empty set. That's exactly one set, and thus the product of no numbers is $1$.
