Pointwise and uniform convergence

I got stuck on two problems that involves finding the pointwisse limits of piecewise functions. Hope someone can give me a hand.

1) Let $\displaystyle \{a_n\}$ be a sequence that contains each rational in [0,1] precisely once. For each $\displaystyle n\in N$, define

$\displaystyle f_n(x)= 0$ if x is irrational

$\displaystyle f_n(a_i)=0$ if $\displaystyle i > n$

$\displaystyle f_n(a_i)=1$ if $\displaystyle i \leq n$

Prove that $\displaystyle \{f_n\}$ converges pointwise on [0,1] to a function that is not R-integrable.

My attempt:

I guess that this sequence of functions converges to the rational characteristic function, but I can't really show $\displaystyle lim f_n=f$ as n approaches infinity.

I tried this again and I got this far: $\displaystyle f(x)=0$ if x is irrational and $\displaystyle f(x)=1$ if x is rational.

Consider: absolute value of $\displaystyle f_n(x)-f(x)$=$\displaystyle 0-0=0< \epsilon$ if x is irrational. Choose $\displaystyle \epsilon=1/2$

If x is rational, $\displaystyle f_n(x)-f(x)=1-1=0< \epsilon$. I think f(x)=1 because eventually $\displaystyle i \leq n$ as n approaches infinity.

2) For $\displaystyle n \in N$ define $\displaystyle f_n: [0,1] \rightarrow R$ by $\displaystyle f_n(x)=1/x$ if $\displaystyle x \in [1/n,1]$ and $\displaystyle f_n(x)=n^2x$ if $\displaystyle x \in [0,1/n)$. Prove that $\displaystyle \{f_n\}$ does not converge uniformly on [0,1] but converge uniformly on [M,1] where 0<M<1.

I don't know what the pointwise limit of $\displaystyle f_n$, so I can't go any anywhere. (Crying) It would be really helpful if someone helps me how to find the pointwise limit