GATE / CS ARCHIVE

GATE CSE 2016 SET 1 / QUESTION 28

GATE CSE 2016 Set 1 Q28

Discrete Mathematics · Sets, Relations & Functions · Full GATE CSE 2016 Set 1 paper

GATE 2016 Set 1, Q28 2 marks · NAT
Report issue

Sets, Relations & Functions

Question 28, GATE 2016: A function f from positive integers to positive integers satisfies f(n)=f(n/2) for even n and f(n)=f(n+5) for odd n. If R is its set of attained values, what is the maximum possible size of R?
Tap to enlarge
Answer & solution

Official answer: 2.0 : 2.0

Our answer: 2

For even n halve n. For odd n>5, applying the odd rule and then halving sends n to(n+5)/2<n. Thus every value eventually reaches 1..5. The numbers 1, 2, 3, 4 are connected by the cycle 1→6→3→8→4→2→1, while 5→10→5 forms another component. Divisibility by 5 is invariant under both rule equalities, so these components never merge. A function constant 1 on nonmultiples of 5 and constant 2 on multiples satisfies both rules and realizes two values. Therefore the maximum range size is 2.

The equations force f to be constant on connected components generated by the permitted transformations. Descent shows there are at most two components, while the divisibility-by 5 invariant proves that they cannot merge. For an odd n,5 divides n+5 exactly when it divides n; for an even n, halving preserves divisibility by 5 because 2 is invertible modulo 5. Assigning two different positive values to these two classes supplies an explicit function attaining the upper bound, so this is a maximum rather than just an estimate.

Original paper, page 12 · Answer key