So for $A :=\{(t,t)\mid t\in\mathbb{R} \backslash (1,1)\}$ in $\mathbb{A}^2(\mathbb{R})$ it seems quite obvious that $I(A)$ should simply be the ideal generated by $x-y$ in $\mathbb{R}[X,Y]$. I tried proving this by sending $f \in I(A)$ to $\mathbb{R}[X]$ with $f(x,y)$ being sent to $g(t):=f(t,t)$ and using the fact that $g$ has infinitely many zeroes. But I'm not sure how to formalize the idea.
As for $B :=\mathbb{Z}^n$ in $\mathbb{A}^n(\mathbb{C})$, I have no clue how one would go about determining $I(B)$. The only fact which seems relevant is that polynomials are holomorphic and therefore analytic, but this doesn't seem to be relevant.
Extra question: what is $V(I(A))$ and $V(I(B))$ where $V$ is the variety of the polynomials.
Thanks in advanced.
For $I(A)$, let $f(x,y)\in I(A)$. Because $$g(t):=f(t,t)\in\mathbb{R}[t]$$ has infinitely many zeros, $g(t)$ is identically zero. That means $f(t,t)=g(t)$ is identically zero. Thus, by treating $f(x,y)$ as an element of the polynomial ring $\big(\mathbb{R}(y)\big)[x]$ in variable $x$ over the field $\mathbb{R}(y)$, we can then see that $f(x,y)$ is divisible by $x-y$. Because $x-y$ is monic in $x$, $$f(x,y)=(x-y)\,q(x,y)$$ for some $q(x,y)\in\big(\mathbb{R}[y]\big)[x]=\mathbb{R}[x,y]$. Therefore, $$I(A)=\langle x-y\rangle\,.$$ Thus, $$V\big(I(A)\big)=\big\{(t,t)\,\big|\,t\in\mathbb{R}\big\}\,.$$
As for $I(B)$, we use the theorem below. Since each $f(z_1,z_2,\ldots,z_n)\in I(B)$ vanishes on $B=\mathbb{Z}^n$. with $\mathbb{Z}$ being an infinite subset of $\mathbb{C}$, we get that $f(z_1,z_2,\ldots,z_n)=0$ identically. Thus, $$I(B)=\{0\}\,,$$ and so $$V\big(I(B)\big)=\mathbb{C}^n\,.$$
For a proof, we work by induction on $n$. If $n=1$, the claim is trivial. Suppose that $n>1$. Write $$f(z_1,z_2,\ldots,z_n)=\sum_{r=0}^d\,f_r(z_1,z_2,\ldots,z_{n-1})\,z_n^r\,,$$ where $d$ is the degree of $z_n$ in $f(z_1,z_2,\ldots,z_n)$, and $$f_r(z_1,z_2,\ldots,z_{n-1})\in \mathbb{K}[z_1,z_2,\ldots,z_{n-1}]$$ for $r=0,1,2,\ldots,d$. Fix an arbitrary tuple $$(s_1,s_2,\ldots,s_{n-1})\in S_1\times S_2\times\ldots\times S_{n-1}\,.$$ Then, $$f(s_1,s_2,\ldots,s_{n-1},z_n)=\sum_{r=0}^d\,f_r(s_1,s_2,\ldots,s_{n-1})\,z_n^r\,,$$ as a polynomial in $z_n$ has infinitely many roots (as it vanishes on $S_n$). Thus, the polynomial $f(s_1,s_2,\ldots,s_{n-1},z_n)$ is identically zero as a polynomial in $z_n$. Ergo, we have $$f_r(s_1,s_2,\ldots,s_{n-1})=0$$ for all $r=0,1,2,\ldots,d$. By induction hypothesis, each $f_r(z_1,z_2,\ldots,z_{n-1})$ is identically zero. Thus, $f(z_1,z_2,\ldots,z_n)$ is also the zero polynomial.
Remark. If $d_j$ is the degree of $z_j$ in $f(z_1,z_2,\ldots,z_n)$ for each $j=1,2,\ldots,n$, then it suffices to only require that $|S_j|>d_j$ for $j=1,2,\ldots,n$. The assertion of the theorem above is still true.