twins function

data from Exercise 7.14, p225