Diagonalization Cardinals Proof 
$B=\{f\in\Bbb{N}\rightarrow \{0,1\}|\,\forall k\in \Bbb{N}.f(2^{k})=f(2^{k+1})\,\} $
Prove that $B$ is not countable.

I'll try to prove it by contradiction.
I'll assume in contradiction that an onto function $g\in\Bbb{N}\rightarrow B$ exists.
$f\in B$ is defined such that $\forall k\in\Bbb{N}. f(2^k)=f(2^{k+1})$, functions has the same value $\{0,1\}$ for $n\in \{1,2,4,8,16..\}$.
$g$ is onto, therefore - 
let $q(\in g) = \lambda n\in\Bbb{N}.\begin{cases}1-g(0)(0) \,&0 \\ 1-g(1)(1) \,&log_2n\in\Bbb{N} \\ 1-g(n)(n+\lceil log_2n \rceil) \,&else  \end{cases}$
We diagonalize each case by changing $\{0,1\}$.
From the assumption that $g$ is surjective, there is $k\in\Bbb{N}$ such that $g(k) = q$,
Therefore - if $k=0,1$ the contradiction is obvious, if $k\ge2$ -
$g(k)(k+\lceil log_2k \rceil) = 1- g(k)(k+\lceil log_2k \rceil)$, Therefore either $q\not\in\Bbb{N}\rightarrow \{0,1\}$ or $g$ is not surjective, and there is no bijective function $\Bbb{N}\rightarrow B$ and $B$ is not countable.
Is my proof legitimate ?
 A: There's a problem in your proof: how do you know that $k$ can't b, say, $4$? (or any other power of 2) In your definition of $q$, you never refer to $g(4)$: for $n = 4$, you pull a value from $g(1)$ and for $n=5$ you pull from $g(5)$.
There's a much easier proof available (namely, there's an onto function from $B$ onto the set of all functions $\mathbb{N} \to \{0, 1\}$, and it's well-known that that set is uncountable), but it is possible to rescue your proof by defining $q$ as:
$$
q(n) = \cases{1-g(0)(0) \,&if $n=0$ \\ 1-g(1)(1) \,&if $n = 2^p$ for some $p \in {\mathbb N}$ \\ 1-g(n - \lceil log_2n \rceil)(n) \,&else}
$$
Then, for $k \geq 2$ we look at $k + \lceil log_2k \rceil$ - either $\lceil log_2(k + \lceil log_2k \rceil)\rceil = \lceil log_2k \rceil$ or
$\lceil log_2(k + \lceil log_2k \rceil)\rceil = \lceil log_2k \rceil + 1$. In either case, we set $\hat{k}$ so that $\hat{k} - \lceil log_2\hat{k} \rceil = k$.
Then we have $g(k)(\hat{k}) \neq q(\hat{k})$, and therefore $g(k) \neq q$.
