For each positive integer \(n\), find the number of odd coefficients in the expansion of \( ( x^2 + x + 1) ^ n \).

I came across this problem and found it interesting. I would like to see how others approached it.

Note: This is a IMO shortlist problem.

## Comments

Sort by:

TopNewestFor each positive integer n, find the number of odd coefficients in the expansion of \( ( x^2+x+1)^n.\)

Let f(n) be the desired number of odd coefficients in \( ( x^2+x+1)^n.\)

... I will be using n=6039 as an example:

1) Write n in base 2 ... \(6039 = 1011110010111_2.\)

Definition: a 1_string is a string of 1's of maximal length in a base 2 number.

For example: 6039 has 4 1_strings. Their lengths are 1, 4, 1 and 3, resp.

2) Examine n's 1's to find all of its 1_strings.

Define f_values for the 3 types of 1_strings:

. a 1_string of length 1 has an f_value of 3.

. a 1_string of even length, le, has an f_value of \( (2^{le+2}-1)/3.\)

. a 1_string of odd length, lo, has an f_value of \( (2^{lo+2}+1)/3.\)

Then f(n) = product of the f_values of n's 1_strings.

For n=6039:

Since 6039's 1_strings have lengths of 1, 4, 1 and 3 resp.

Their f_values are 3, 21, 3 and 11, resp.

So f(6039) = 3 X 21 X 3 X 11 = 2079.

Excellent problem ...

I found pretty quickly that for all n>=0, \(f(2^n) = 3.\)

After that I made little further progress, I decide to research the problem. I found, online the book

(PDF) Enumerative Combinatorics by Richard Stanley where I found how to compute f(n). – Michael Fischer · 2 years ago

Log in to reply

I get \[\text{Coefficient of} \ x^r=\displaystyle\sum_{k=0}^{\lfloor r \rfloor /3} (-1)^k \dbinom{n+3-3k-1}{r-3k} \dbinom{n}{k}\] where \(\lfloor r \rfloor\) is the greatest multiple of \(3\) less than or equal to \(r\), and \(r \in \{0,1, \ ... \ ,2n \}\) .

How do we know how many of these monsters are odd? – Pratik Shastri · 2 years, 1 month ago

Log in to reply

For example, if we were merely dealing with \( (x+1)^n \), then it is a well known result that the number of odd coefficients is \( 2^b \), where \(b\) equals the number of 1's in the binary representation of \(n\). There can be several ways to show this, one of which includes finding explicitly which terms are odd (using Lucas Theorem). – Calvin Lin Staff · 2 years, 1 month ago

Log in to reply

– Bogdan Simeonov · 2 years, 1 month ago

I got a somewhat similar result.Is there an easy way to see if a binomial is odd or even?Log in to reply

I cheated a little bit (ok, a lot):

http://oeis.org/A071053

I don't see anything like a closed-form formula. This paper seems to be all about finding this function's asymptotics:

http://arxiv.org/abs/0802.2654

I can show that the answer is \( 3 \) if \( n \) is a power of \( 2 \). :) – Patrick Corn · 2 years, 1 month ago

Log in to reply

– Calvin Lin Staff · 2 years, 1 month ago

There is a way to define the number of coefficients in a closed form formula, i.e. only depends on the value of \(n\).Log in to reply

Well, using trinomials I found the formula for the coefficients but it's a sum of trinomials and I can't find any easy parity criteria for that. – Bogdan Simeonov · 2 years, 1 month ago

Log in to reply

– Bogdan Simeonov · 2 years, 1 month ago

Or maybe if we denote \(k_n\) the coeff of x^k in the polynomial, we can get that \(\displaystyle k_n=\sum_{i=1}^{n-1} (k-1)_i+(k-2)_i\)Log in to reply

So...

\((x^2+(x+1))^n\)? Hmmmmm.... the answer will be in terms of x. Can't wait to see the solutions (wish had time to solve it)! – John Muradeli · 2 years, 1 month ago

Log in to reply

For example: If \( n = 1 \), then we have \( x^2 + x + 1 \), which has 3 terms of odd coefficients.

If \( n = 1 \), then we have \( (x^2 + x + 1)^2 = x^4 + 2x^3 + 3x^2 + 2x + 1 \), which has 3 terms of odd coefficients.

If \( n = 3 \), then we have \( (x^2 + x + 1) ^3 = x^6 + 3x^5 + 6x^4 + 7x^3 + 6x^2 + 3 x + 1 \), which has 5 terms of odd coefficients. – Calvin Lin Staff · 2 years, 1 month ago

Log in to reply

– Adrian Neacșu · 2 years, 1 month ago

Can you say more things about IMO problems I just heard about them from this note. How can you post a solution?Log in to reply

odd, oddeven etc. Yes the answer may be (or, like you said, will be) in terms of n. And now it'll be great to see why it's \(n+2\) (or maybe not ;)) – John Muradeli · 2 years, 1 month agoLog in to reply

Calvin My questions are not been rated yet They have been uploaded 3days before Plz give me your e mail id so that i can contact you Your's faithfully Jai gupta – Jai Gupta · 2 years, 1 month ago

Log in to reply

I typically do not like "Find this pattern" unless it is very obvious, since there are numerous ways of justifying the next term (e.g. there is always a polynomial which satisfies any finite sequence). I appreciate seeing your solutions, but I don't understand them. Can you please reply to my comments? Thanks. – Calvin Lin Staff · 2 years, 1 month ago

Log in to reply

Log in to reply

I have a question about it through, please reply to my comment in your solution. – Calvin Lin Staff · 2 years, 1 month ago

Log in to reply