Math, asked by nishigandhasable56, 11 months ago

A function f satisfies f(0) = 0, f(2n) = f(n), and f(2n + 1) = f(n) + 1 for all positive integers n. What is the value of f(2018)?

Answers

Answered by johnjagan13pe216o
3

It is recursive functions ,

f(2018)-->f(2*1009)

as per 2nd eq, f(2*1009) = f(1009)

f(2 * 504 + 1 ) = f(504) + 1

f(2 * 251) = f(251)

f(2 * 125 + 1) = f(125) + 1

f(2 * 62 + 1) = f(62) + 1

f(2 * 31) = f(31)

f(2 * 15 + 1) = f(15) + 1

f(2 * 7+ 1) = f(7) + 1

f(2 * 3+ 1) = f(3) + 1

f(2 * 1+ 1) = f(1) + 1

f(2 * 0+ 1) = f(0) + 1

as per given , f(0) = 0

count all 1's

therefore f(2018) = 8

Similar questions