Smatchcube's website 🌍

Exercise 2.5

Following the representation of a pair in this exercise we can define the cons procedure with the expt primitive (you can easily create your own expt procedure though).

A power of 2 is even and a power of 3 is odd (we can easily prove that with mathematical induction) so we can define the car and cdr procedures counting the number of times we can divide by 2 or 3 the pair represented by an integer.