1. add the 3rd implementation

1. using recursion function
2. remove variable R