This question is from the book Abstract Algebra: Theory and Applications by Thomas W. Judson.
Chapter 1 – Question 20
(a) Define a function $f : \mathbb{N} \to \mathbb{N}$ that is one-to-one but not onto.
(b) Define a function $f : \mathbb{N} \to \mathbb{N}$ that is onto but not one-to-one.