Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

All the positive numbers can be expressed as a sum of one, two or more consecutive positive integers. For example 9 can be expressed in three such ways, 2+3+4, 4+5 or 9. In how many ways can a number be expressed as a sum of consecutive numbers?

Here for 9 answer is 3, for 10 answer is 3, for 11 answer is 2.

share|improve this question
    
@BhavikAmbani, this question is like asking if n is a fibonacci number. The solution can be calculated, but it can't be represented by a simple formula, unless you're saying something trivial like $f(n) \Leftrightarrow f(n - 1) + f(n - 2)$ –  Neil May 2 '12 at 10:37
    
@BhavikAmbani: Many things are counted without explicit formulas, like the prime counting function. However, this question is equivalent to the Diophantine(ish?) problem of counting the integer solutions $(a,b)$ with $a<b$ to $$(b+a)(b-a+1)=2n$$ for $n$ given but unknown. –  anon May 2 '12 at 10:49
    
@anon Very true, at least provide the basic logic for that –  Bhavik Ambani May 2 '12 at 10:58
1  
Please do not engage in excessive discussions in the comments. If you wish to discuss, please use our chatroom instead. I'll be cleaning up the comments here which are wandering a bit off-topic in a minute or so. –  Willie Wong May 2 '12 at 10:59
2  
@BhavikAmbani: (fixed bad typo, earlier now deleted comment) The following is a formula quoted from the post I referred to. For the proof please see the post. If $$w=2^{a_0}p_1^{a_1}p_2^{a_2}\cdots p_k^{a_k},$$ where the $p_1,p_2,\dots,p_k$ are distinct odd primes, then the number of non-trivial representations of $w$ is $$(a_1+1)(a_2+1)\cdots(a_k+1).$$ –  André Nicolas May 2 '12 at 17:31

5 Answers 5

up vote 7 down vote accepted

Here's one more way to calculate this, from my answer to this question on another site:

An integer $n$ is expressible as the sum of $m$ consecutive positive integers if and only if either:

  • $m$ is odd and $\frac nm$ is an integer, or
  • $m$ is even and $\frac nm + \frac12$ is an integer,

and $\frac nm \ge \frac m2$ (or else some of the integers in the sum would be zero or negative).

These conditions follow from the fact that the sum of an arithmetically increasing sequence of $m$ numbers equals $m$ times the mean of the numbers.

The last condition can be rewritten as $m \le \sqrt{2n}$. Thus, it's sufficient to iterate over all integers $m$ from $1$ to $\lfloor \sqrt{2n} \rfloor$ and check whether $\frac nm + \frac m2 + \frac12$ is an integer.

share|improve this answer
1  
Very Good Answer.. +1 for this –  Bhavik Ambani May 3 '12 at 5:06

A sum of consecutive numbers is a difference of triangular numbers. The paper below gives a solution for the case of nonconsecutive triangular numbers.

Nyblom, M. A. On the representation of the integers as a difference of nonconsecutive triangular numbers. Fibonacci Quart. 39 (2001), no. 3, 256–263.

The main result is that the number of distinct representations of a nonzero integer $m$ as a difference of nonconsecutive triangular numbers is given by $d−1$, where $d$ is the number of odd divisors of $m$.

share|improve this answer
2  
An equivalent statement to that main result is given in the comments on A001227, although without reference. –  Peter Taylor May 2 '12 at 13:59
    
Also explained in an answer by André Nicolas. –  lhf May 2 '12 at 14:14

Fix $k$. Is there a way that a number $N$ can be written in more than one way as a sum of $k$ consecutive number? Certainly not because $$ a+(a+1)+\cdots+(a+k-1)\neq b+(b+1)+\cdots+(b+k-1) $$ if $a\neq b$. On the other hand $N$ is the sum of $k$ consecutive number if and only if $N$ is the form $$ N=\frac12\left[(n+k)(n+k+1)-n(n+1)\right] $$ for some $n$. Does that help?

share|improve this answer
    
Thanks a lot for your efforts, but this does not make any solution for me –  Bhavik Ambani May 2 '12 at 11:05
    
It was not intended as a solution, but as a hint/help. –  Andrea Mori May 2 '12 at 12:30
    
But sorry I couldn't get your hint till now. –  Bhavik Ambani May 2 '12 at 12:31

Factorise the number and find the number of odd factors . Total number of odd factors (except 1) is the answer.

Express N in terms of prime factors

$N = a^p . b^q . c^r$

If a = 2 . Number of odd factors = (q+1)(r+1) - 1 . Note : 1 is subtracted because 1 cannot be answer as consecutive terms means greater than 1 term.

For eg.

$100 = 2^2 . 5^2 $

So Number of odd factors = (2+1) - 1 = 2 = Number of ways of writing 100 as sum of 2 or more consecutive integers . They are
18, 19, 20, 21, 22

9,10,11,12,13,14,15,16

ANSWER:

Number of ways of writing N as sum of consecutive positive integers is Number of odd factors in that number (except 1).

Also see : http://mathblag.wordpress.com/2011/11/13/sums-of-consecutive-integers/

share|improve this answer

I thought of this same question several months ago during one of my classes and I worked out the solution during my lunch break, the same sort of argument could be used to find the number of representations of $n$ in any arithmetic sequence modulo a positive integer. I got that if $S(n)$ denotes the number of representations of $n$ as a sum of successive natural numbers with $n\ge 1$ then that:

$$S(n)=d(\frac{n}{2^{v_2(n)}})$$

Where $v_2(n)$ is the $2$-adic order of $n$, what I did was used the fact that:

$$\sum_{a^2+ab=n}_{(a,b)\in \mathbb{N^2}}f(a,b)=\sum_{b=\frac{n}{a}-a}_{(a,b)\in \mathbb{N^2}}f(a,b)=\sum_{d\mid n}_{d<\sqrt{n}}f(d,\frac{n}{d}-d)$$

To rewrite: $$S(n)=\sum_{a+(a+1)+(a+2)+\dots +(b-1)+b=n}_{b\ge a}_{(a,b)\in \mathbb{N^2}}1=\sum_{(a+b)(a-b+1)=2n}_{b\ge a}_{(a,b)\in \mathbb{N^2}}1=\sum_{a^2-b^2+a+b=2n}_{b\ge a}_{(a,b)\in \mathbb{N^2}}1$$

And then simplified the resulting sum by swapping the summation indices several times and by setting $b=a-1+k$ with $k\in \mathbb{N}$ since we have that $b\ge a$.

This was the proof I scribbled down, where I used $\chi_2$ to denote the Dirichlet character modulo $2$.

Sorry if it's kind of messy:

enter image description here enter image description here

share|improve this answer
    
Good one, +1 for the nice explaination :) –  Bhavik Ambani Mar 20 at 9:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.