TCS
Company
he function f is defined on the set of positive integers in the following way:
f(1) = 2
f(2*n) = f(n)
f(2*n+1) = f(n) + f(n+1)
What is f(17)?
option
a) 10
b) 2
c) 8
d) 17
e) 6
Read Solution (Total 8)
-
- f(17)=f(8)+f(9)
f(8)=f(2*4)=f(4)
f(2*2)=f(2)=2;
f(9)=f(4)+f(5)=2+f(2)+f(3)=4+f(1)+f(2)=4+4=8
therefore,f(17)=2+8=10
hence ans is 10 - 11 years agoHelpfull: Yes(56) No(3)
- f(8)+f(9)
f(4)+(f(4)+f(5))
.....
....
2+2+2+2+2=10 is ans..
- 11 years agoHelpfull: Yes(13) No(1)
- 8
f(17) = f(2*8 + 1) = f(8) + f(9)
=> f(17) = f(2*4) + f(2*4 + 1)
=> f(4) + f(4) + f(5)
=> f(2*2) + f(2*2) + f(2*2 + 1)
=> f(2) + f(2) + f(2) + f(1)
=> 3f(2) + f(1)
=> 3f(2*1) + f(1)
=> 3f(1) + f(1)
=> 4f(1)
= 8 - 11 years agoHelpfull: Yes(6) No(25)
- ansewr is 10
- 11 years agoHelpfull: Yes(6) No(2)
- ans is exactly 10
- 11 years agoHelpfull: Yes(3) No(1)
- 10 is the ans
- 11 years agoHelpfull: Yes(2) No(0)
- f(17)=f(2*8+1)
=f(2*4)+f(2*4+1)
=f(4)+f(4)+f(5)
=f(2*2)+f(2*2)+f(2)+f(3)
=f(2)+f(2)+f(1)+f(2)
=f(1)+f(1)+f(1)+f(1)+f(1)=10 - 11 years agoHelpfull: Yes(2) No(0)
- answer is 10
- 11 years agoHelpfull: Yes(0) No(0)
TCS Other Question