hofstadter g sequence in ruby