0
What is the formula?
// sequence of number 1,3,7,15,31,63,127... Write a program with recursive function. When user enter 6 display 63.
3 Answers
0
Whar you tried so far..?
Did you find logic..?
0
u[1] = 1
u[i] = u[i-1]*2 + 1
so:
u[2] = 1*2 + 1 => 3
u[3] = 3*2 + 1 => 7
u[4] = 7*2 + 1 => 15
u[5] = 15*2 + 1 => 31
u[6] = 31*2 + 1 => 63
...
or, in a non recursive way:
u[i] = 2^i - 1
(where ^ is the power operator)
0
Ok~thank you very much



