given that g is deals only with natural numbers,

g(0)=0

g(1)=1

g(n)=g(n/2) +1 when n is even and greater than 1

g(n)= g(3n+1) +1 when n is odd and greater than 1

what is g(23)

i know i need to use recursion but i cant seem to get it.

Results 1 to 2 of 2

- Jan 23rd 2011, 01:19 PM #1

- Joined
- Aug 2009
- Posts
- 639

- Jan 23rd 2011, 01:31 PM #2

- Joined
- Oct 2009
- Posts
- 5,573
- Thanks
- 789

Replace n by 23 in the following.

g(n)=g(n/2) +1 when n is even and greater than 1

g(n)= g(3n+1) +1 when n is odd and greater than 1