The set of functions that are zero almost everywhere is enumerable I have become somewhat overwhelmed with a problem I am working on I had a friend tell me that my proof was wrong. I would be grateful if someone could explain why I am wrong, and possibly offer a alternate solution. 
Problem: A function $f\colon \mathbb{N} \to \mathbb{N}$ is zero almost everywhere iff $f(n)=0$ for all except a finite number of arguments. It can be shown that the set of functions that are zero almost everywhere is enumerable. 
Attempt: Let $E=\{f\colon \mathbb{N} \to \mathbb{N}\mid f \text{ is zero almost everywhere}\}$. Let $Q\colon \mathbb{N}\to E$ such that $Q(n)=f_n$ where we define $f_n(x)=0$ for all but $n\in\mathbb{N}$ values. 
Fix $f\in E$, then we need show that there exists some integer $n\in N $ such that $f=f_n$, but by defnition $f$ is zero almost everywhere, so $f(x)=0$ for all but a finite  $r\in\mathbb{N}$ values. Choose $n=r$. 
I realize that this is a incorrect proof, but I'm not really sure where. I also never used a hint I was given which says to use the fact that a countable union of countable sets is countable. 
Thank you.
 A: We will find an explicit bijection from $E$ to $\mathbb{N}\setminus\{0\}$. Getting an explicit bijection from $E$ to $\mathbb{N}$ (or in the other direction) is then easy.
Let $p_0,p_1,p_2,\dots$ be the primes in their natural order. If $f$ is a function which is $0$ almost everywhere, map $f$ to
$$p_0^{f(0)}p_1^{f(1)}p_2^{f(2)}p_3^{f(3)}\cdots.\tag{1}$$
The product in (1) is a finite product. By the Fundamental Theorem of Arithmetic, the mapping we have just defined is a bijection from $E$ to $\mathbb{N}\setminus\{0\}$. 
A: $Q$ is not correctly defined. You say that $Q(n)$ is a function that is not zero for exactly $n$ values, but there are (infinitely) many functions that satisfy this property.
If you specify which is that function (or use the Axiom of Choice), then $Q$ will be certainly not surjective.
How about the following? Define $E_k$ as the set of functions that are $0$ for $n>k$ (for $n\le k$ may be zero or not). Then $E_k$ is finite. Now use the hint you mentioned.
A: Hint: Count your functions as follows. Let $A_N$ be the set of all functions which are non-zero only for $n \leq N$ and all non-zero values of the function are less than or equal to $N$. Clearly your set is $\cup_N A_N$. But each $A_N$ is finite, so if you know that a countable union of finite sets is at most countable, then you are done.
A: A common way to prove a set is enumerable is to use the following fact (also the hint you provided):

A union of at most countably many enumerable sets is enumerable.

The proof of this statement goes exactly like the usual proof that the rationals are enumerable.
With this, can you decompose your set $E$ into a union of countable many enumerable sets? 

(Hint: How many elements of $E$ have exactly $1$ nonzero element? How many with exactly $2$? How many...)

A: Each $\Bbb N\to\Bbb N$ function is a natural sequence. Let's define a 'portrait' of an almost-everywhere zero function as a finite sequence of all arguments, for which the function has non-zero value, interleaved with those values. For example $f=(0, 0, 15, 0, 27, 0,...)$ has a portrait $P(f)=(3, 15, 5, 27)$. Of course the portrait is unique: each function has its own portait. Let's also define a natural 'size' of a function $f$ as a sum of portrait's terms $S(f)=\sum_{n\in\Bbb N}P(f)_n$. The example function above has size $3+15+5+27=50$.
All functions can be ordered by an increasing size. There is of course many, but always finitely many functions of the same size. All functions of the same size can be ordered lexicographically by their portrait.
This way we define a sequence of all almost-everywhere zero natural sequences, which estabilishes their enumerability.
