The algorithm for calculating the value of the function F(n)
, where n
– non-negative number, is given by the following relations:
F(0) = 9;
F(n) = n/3 + f(n/3)
if n > 0
, and the number n
is a multiple of 9;
F(n) = n/2 + f(n/2)
otherwise.
Determine how many different values the F(n)
function takes on the segment [1, 1000000]?
The sign /
- means the operation of integer division.