Implement continued-fraction