Resisting Zero

Define the following function for all positive integers n n : f ( n ) = { n 2 if n is even n 1 if n is odd f(n)= \begin{cases} \dfrac{n}{2} & \text{if } n \text{ is even} \\ n - 1 & \text{if } n \text{ is odd} \end{cases} It can be shown that if you iterate this function enough times on any starting input n n , you will eventually reach 0 and be stuck there forever. We define a number's "resistance" to be the amount of iterations of f f on this number it takes to reach 0. For example, consider what happens when the starting input is 15:

Input 1 : f ( 15 ) = 14 2 : f ( 14 ) = 7 3 : f ( 7 ) = 6 4 : f ( 6 ) = 3 5 : f ( 3 ) = 2 6 : f ( 2 ) = 1 7 : f ( 1 ) = 0 \begin{array} {rc} \text{Input }1: & f(15) = 14 \\ 2: & f(14) = 7 \\ 3: & f(7) = 6 \\ 4: & f(6) = 3 \\ 5: & f(3) = 2 \\ 6: & f(2) = 1 \\ 7: & f(1) = 0 \\ \end{array}

It took 7 iterations with a starting input of 15 to reach 0, so the number 15 has a resistance of 7.

How many numbers (including 15) are there in total that have a resistance of 7?


The answer is 13.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Max Patrick
Oct 18, 2019

Rank every number by its resistance, with the integer 1 being the sole number in row 1, integer 2 being the sole number in row 2, integers 3 and 4 being in row 3 and so on. Place row 1 at the bottom and work up.

Let a ( n ) a(n) be the number of odd integers in row n n .

Let b ( n ) b(n) be the number of even integers in row n n .

Let c ( n ) c(n) be the total number of integers in row n n .

c ( n ) = a ( n ) + b ( n ) c(n)=a(n)+b(n)

Notice that an odd integer p p puts 1 integer (even) into the row above which is 2 p 2p .

An even integer q q puts two integers into the row above (one odd, one even) - q + 1 q+1 and 2 q 2q

Thus a ( n + 1 ) = b ( n ) a(n+1)=b(n)

and

b ( n + 1 ) = a ( n ) + b ( n ) b(n+1)=a(n)+b(n)

a ( n + 2 ) = b ( n + 1 ) a(n+2)=b(n+1)

and

b ( n + 2 ) = a ( n + 1 ) + b ( n + 1 ) = a ( n + 1 ) + a ( n ) + b ( n ) b(n+2)=a(n+1)+b(n+1)=a(n+1)+a(n)+b(n)

a ( n + 2 ) + b ( n + 2 ) = a ( n + 1 ) + b ( n + 1 ) + a ( n ) + b ( n ) a(n+2)+b(n+2)=a(n+1)+b(n+1)+a(n)+b(n)

c ( n + 2 ) = c ( n + 1 ) + c ( n ) c(n+2)=c(n+1)+c(n)

Stop right there! c ( n ) c(n) , the number of integers in a row, is the Fibonacci sequence. 1,1,2,3,5,8,13

c ( 7 ) = 13 c(7)=\boxed{13} .

I really like this solution :3

Daniel Hinds - 1 year, 7 months ago

Hear, hear. Another seemingly unrelated scenario which is connected to the Fibonacci sequence!

David Stiff - 1 year, 2 months ago
Mark Hennings
Oct 17, 2019

If R ( n ) R(n) is the resistance of n n then it is clear that R ( 1 ) = 1 R(1) = 1 and that R ( 2 n ) = R ( n ) + 1 R ( 2 n + 1 ) = R ( n ) + 2 R(2n) \; = \; R(n) + 1 \hspace{2cm} R(2n+1) = R(n) + 2 for all n N n \in \mathbb{N} . This means that R ( n ) = D ( n ) + C ( n ) 1 R(n) \; = \; D(n) + C(n) - 1 where D ( n ) D(n) is the number of digits, and C ( n ) C(n) the number of 1 1 s, in the binary expansion of n n . To find numbers with resistance 7 7 , we want numbers with D ( n ) + C ( n ) = 8 D(n) + C(n) = 8 , and we have the following possibilities (we must have D ( n ) C ( n ) 1 D(n) \ge C(n) \ge 1 ): D ( n ) C ( n ) C o u n t 4 4 1 5 3 ( 4 2 ) = 6 6 2 ( 5 1 ) = 5 7 1 ( 6 0 ) = 1 \begin{array}{|c|c|c|} \hline D(n) & C(n) & \mathrm{Count} \\ \hline 4 & 4 & 1 \\ 5 & 3 & \binom{4}{2} = 6 \\ 6 & 2 & \binom{5}{1} = 5 \\ 7 & 1 & \binom{6}{0} = 1 \\ \hline \end{array} (note that the first digit of a binary number must be 1 1 ), making the total count 13 \boxed{13} .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...