Define the following function for all positive integers n : f ( n ) = { 2 n n − 1 if n is even if n is odd It can be shown that if you iterate this function enough times on any starting input 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 on this number it takes to reach 0. For example, consider what happens when the starting input is 15:
Input 1 : 2 : 3 : 4 : 5 : 6 : 7 : f ( 1 5 ) = 1 4 f ( 1 4 ) = 7 f ( 7 ) = 6 f ( 6 ) = 3 f ( 3 ) = 2 f ( 2 ) = 1 f ( 1 ) = 0
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?
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.
I really like this solution :3
Hear, hear. Another seemingly unrelated scenario which is connected to the Fibonacci sequence!
If R ( n ) is the resistance of n then it is clear that R ( 1 ) = 1 and that R ( 2 n ) = R ( n ) + 1 R ( 2 n + 1 ) = R ( n ) + 2 for all n ∈ N . This means that R ( n ) = D ( n ) + C ( n ) − 1 where D ( n ) is the number of digits, and C ( n ) the number of 1 s, in the binary expansion of n . To find numbers with resistance 7 , we want numbers with D ( n ) + C ( n ) = 8 , and we have the following possibilities (we must have D ( n ) ≥ C ( n ) ≥ 1 ): D ( n ) 4 5 6 7 C ( n ) 4 3 2 1 C o u n t 1 ( 2 4 ) = 6 ( 1 5 ) = 5 ( 0 6 ) = 1 (note that the first digit of a binary number must be 1 ), making the total count 1 3 .
Problem Loading...
Note Loading...
Set Loading...
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 ) be the number of odd integers in row n .
Let b ( n ) be the number of even integers in row n .
Let c ( n ) be the total number of integers in row n .
c ( n ) = a ( n ) + b ( n )
Notice that an odd integer p puts 1 integer (even) into the row above which is 2 p .
An even integer q puts two integers into the row above (one odd, one even) - q + 1 and 2 q
Thus a ( n + 1 ) = b ( n )
and
b ( n + 1 ) = a ( n ) + b ( n )
a ( n + 2 ) = b ( n + 1 )
and
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 )
c ( n + 2 ) = c ( n + 1 ) + c ( n )
Stop right there! c ( n ) , the number of integers in a row, is the Fibonacci sequence. 1,1,2,3,5,8,13
c ( 7 ) = 1 3 .