GATE / CS ARCHIVE

GATE CSE 2022 / QUESTION 51

GATE CSE 2022 Q51

Discrete Mathematics · Proof Techniques & Number Theory · Full GATE CSE 2022 paper

GATE 2022, Q51 2 marks · MSQ
Report issue

Proof Techniques & Number Theory

Question 51, GATE 2022: Given f(1)=1, f(2n)=2f(n)−1, f(2n+1)=2f(n)+1 for n≥1, select identities for positive n: A f(2^n−1)=2^n−1; B f(2^n)=1; C f(5·2^n)=2^(n+1)+1; D f(2^n+1)=2^n+1.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A,B,C

For positive integer n, prove A by induction: f(1)=1, and applying the odd recurrence to 2n+1-1=2(2n-1)+1 preserves f(2n-1)=2n-1. For B, repeated use of f(2m)=2f(m)-1 starting with f(1)=1 yields f(2n)=1. Also f(5)=2f(2)+1=3. Repeated doubling gives f(5*2n)-1=2n(f(5)-1)=2n+1, proving C. D is false: at n=2, f(5)=3 whereas 22+1=5.

A useful closed form is f(m)=2(m−2^⌊log2(m)⌋)+1. It follows by induction on the binary length: the leading 1 determines the power of two, and the even/odd recurrence appends a bit while updating the residual. Substituting m=2n−1,2n,5·2n confirms the three identities and also shows f(2n+1)=3, not 2n+1 for n≥2.

Original paper, page 34 · Answer key