any ideas how to write this function?

Printable View