Function from integers to integers

Let f : N N f:\mathbb{N} \rightarrow \mathbb{N} be a function such that f ( 1 ) = 1 f(1)= 1 , and for all positive integers n , n, f ( 2 n ) = f ( n ) f(2n)= f(n) and f ( 2 n + 1 ) = f ( n ) + f ( n + 1 ) f(2n+1)= f(n) + f(n+1) . Find the number of odd integers n n such that f ( n ) = 2015 f(n)= 2015 .

Details and assumptions

  • This problem is not original.


The answer is 1440.

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.

1 solution

We need to find the number of integers k k such that f ( 2 k + 1 ) = 2015 f ( k ) + f ( k + 1 ) = 2015 f(2k+1) = 2015 \implies f(k) + f(k+1)= 2015 .


Claim 1: gcd ( f ( n ) , f ( n + 1 ) ) = 1 \gcd (f(n), f(n+1)) = 1 for all n N n \in \mathbb{N}

Proof: Use strong induction. The base cases can be manually verified. Now, suppose n n is even, say n = 2 k n= 2k . Then, f ( n + 1 ) = f ( k ) + f ( k + 1 ) f(n+1) = f(k) + f(k+1) and f ( n ) = f ( k ) f(n) = f(k) , so gcd ( f ( n ) , f ( n + 1 ) ) = gcd ( f ( k ) , f ( k + 1 ) ) , \gcd (f(n), f(n+1))= \gcd (f(k), f(k+1)), which is equal to 1 1 by the inductive hypothesis. Now suppose n n is odd, say n = 2 k + 1 n= 2k+1 . Then, f ( n ) = f ( k ) + f ( k + 1 ) f(n)= f(k) + f(k+1) and f ( n + 1 ) = f ( k + 1 ) f(n+1) = f(k+1) , so gcd ( f ( n ) , f ( n + 1 ) ) = gcd ( f ( k ) , f ( k + 1 ) ) = 1 \gcd (f(n), f(n+1)) = \gcd (f(k), f(k+1))= 1 . \blacksquare


Claim 2: For all integers a a and b b such that gcd ( a , b ) = 1 \gcd (a, b)= 1 , there exists a unique n n such that f ( n ) = a , f ( n + 1 ) = b f(n) = a, f(n+1)= b .

Proof: Use strong double induction on a a and b b . For the base case ( a , b ) = ( 1 , 1 ) (a, b)= (1, 1) , note that if t t is an odd integer > 1 >1 , for all k k , f ( 2 k t ) = f ( t ) = f ( ( t 1 ) / 2 ) + f ( ( t + 1 ) / 2 ) > 1 f(2^k t) = f(t) = f((t-1)/2) + f((t+1)/2)>1 , so f ( n ) = 1 f(n)=1 if and only if n n is a power of 2 2 , and the only consecutive powers of 2 2 are 2 0 2^0 and 2 1 2^1 .

Suppose the claim holds true for all 1 a i 1 \leq a \leq i and b = 1 b=1 . Suppose m m is the unique integer such that f ( m ) = a , f ( m + 1 ) = 1 f(m) = a, f(m+1)= 1 . Then, note that f ( 2 m + 1 ) = a + 1 , f ( 2 m + 2 ) = 1 f(2m+1) = a+1, f(2m+2)= 1 . Again, if there existed another integer t t such that f ( t ) = a + 1 , f ( t + 1 ) = 1 f(t) = a+1, f(t+1) = 1 , then we would have f ( t 1 ) / 2 ) = f ( t ) f ( t + 1 ) = a f(t-1)/2) = f(t) - f(t+1) = a (note that since t + 1 t+1 must be a power of 2 2 , t t is odd), so the uniqueness of m m implies t 1 2 = m t = 2 m + 1 \dfrac{t-1}{2} = m \implies t= 2m+1 , so 2 m + 1 2m+1 is the unique integer such that f ( 2 m + 1 ) = a + 1 , f ( 2 m + 2 ) = 1 f(2m+1) = a+1, f(2m+2) = 1 . Thus, our claim holds true for all integers a a when b = 1 b=1 .

For some a a , let m m be the unique integer such that f ( m ) = a , f ( m + 1 ) = b f(m) = a, f(m+1) = b . Then, by the mimicking the logic, as in the first paragraph 2 m 2m is the unique integer such that f ( 2 m ) = a , f ( 2 m + 1 ) = a + b f(2m) = a, f(2m+1) = a+b and 2 m + 1 2m+1 is the unique integer such that f ( 2 m + 1 ) = a + b , f ( 2 m + 2 ) = b f(2m+1)= a+b, f(2m+2) = b . Note that gcd ( a , a + b ) = gcd ( a , b ) = 1 \gcd (a, a+b) = \gcd (a, b) = 1 . Thus, if the claim us true for a pair ( a , b ) (a, b) where gcd ( a , b ) = 1 \gcd (a, b) =1 , it must also be true for the pairs ( a , a + b ) (a, a+b) and ( a + b , a ) (a+b, a) .

Consider any co prime pair ( p , q ) (p, q) .If q > p q>p , by our inductive hypothesis, the claim is true for ( p , q p ) (p, q-p) , and hence, must also be true for ( p , q p + p ) = ( p , q ) (p, q-p+p) = (p, q) . We similarly prove the case when p > q p>q . \blacksquare


By the claims, the answer is simply the number of integers a , b a, b such that a + b = 2015 a+b= 2015 and gcd ( a , b ) = 1 \gcd (a, b) = 1 . Since gcd ( a , b ) = gcd ( a , a + b ) = gcd ( a , 2015 ) \gcd (a, b) = \gcd (a, a+b) = \gcd (a, 2015) , this is simply the number of integers < 2015 <2015 and coprime to 2015 2015 , which is simply φ ( 2015 ) = 1440 \varphi (2015) = \boxed{1440} .

what about 2^2014+1

汉卿 蔣 - 6 years, 2 months ago

How can we prove what the function is,though?The setting of the function obviously screams out binary.After checking the first 15 values or so,I have come to a conjecture,but it is really difficult to express in English.But f ( n ) f(n) has to do with the number of characters(1 or 0) inclusive between two $1$s in the binary representation of n.

Rahul Saha - 6 years, 3 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...