I am having a difficulty figuring out the equation to get the ith element in $\mathbb{N}\times \mathbb{N}$ ( crossing the set of natural numbers).We have $\mathbb{N}\times \mathbb{N} = \{ (1,1),(1,2),(2,1),(1,3),(2,2)\dots\}$ if we traverse the matrix with a diagonal.Can someone help me in getting this equation ?
I want to do a small program that takes index $i$ , and return the $i$th element in $\mathbb{N}\times\mathbb{N}$.This will be used for demonstration
OEIS sequences A002260 and A004736