I have a recursive function that gives some sequence:
def f(n): if n <= 0: return 0 else: return 1-(n%2)+f(n/2)
Which returns a number. So I need to say what's the logic in this number, and is some logical explanation to this numbers cause, for ex, the number from this function:
def f(n): if n <= 0: return 0 else: return (n%2)+f(n/2)
is the sum of digits in the "n" number in binary numerical system representation: n = 12 == 1100 -> so f(12) return 2, cause 1+1+0+0 = 2. But what's the logic in the first function?