added a naive recursive function for comparison
document update