Implement problem set 3 for 2x