Need Some Math Help

So to all math geniuses here, could you help me a bit? i’m stuck on some problems a college prof gave us on a seminar and need some answers by monday. 72/72 of us failed to get any answer as of now:P

so yeah. only in third year high school and know no **** about this. any help dudes?

Question 1

Let N = {1,2,3,4…}

f(N) = N satisfying:

a.f(1) = 1
b.f(2n) = f(n)
c.f(2n+1) = f(2n)+1

find an algorithm to solve for f(n)

Question 2

Prove that a+b = c+d

btw, those are all right triangles.

i’ll give a cookie to someone who can explain it to me:D
thanks dudes!