implement iterable version of hofstadter q