login
Number of ways n can be written as a sum of at least three consecutive integers.
4

%I #46 Jan 19 2021 06:27:32

%S 0,0,0,0,0,1,0,0,1,1,0,1,0,1,2,0,0,2,0,1,2,1,0,1,1,1,2,1,0,3,0,0,2,1,

%T 2,2,0,1,2,1,0,3,0,1,4,1,0,1,1,2,2,1,0,3,2,1,2,1,0,3,0,1,4,0,2,3,0,1,

%U 2,3,0,2,0,1,4,1,2,3,0,1,3,1,0,3,2,1,2,1,0,5,2,1,2,1,2,1,0,2,4,2,0,3,0,1

%N Number of ways n can be written as a sum of at least three consecutive integers.

%C Powers of 2 and (odd) primes cannot be written as a sum of at least three consecutive integers. a(n) strongly depends on the number of odd divisors of n (A001227): Suppose n is to be written as sum of k consecutive integers starting with m, then 2n = k(2m + k - 1). Only one of the factors is odd. For each odd divisor of n there is a unique corresponding k, k=1 and k=2 must be excluded.

%C When the initial 0 term is a(1), a(n) is the number of times n occurs after the second column in the square array of A049777. - _Bob Selcoe_, Feb 14 2014

%C For nonnegative integers x,y where x-y>=3: a(n) equals the number of ways n can be expressed as a function of (x*(x+1)-y*(y+1))/2 when the initial 0 term is a(1). - _Bob Selcoe_, Feb 14 2014

%D Nieuw Archief voor Wiskunde 5/6 nr. 2 Problems/UWC Problem C part 4, Jun 2005, p. 181-182

%H Alois P. Heinz, <a href="/A111775/b111775.txt">Table of n, a(n) for n = 1..10000</a>

%H K. S. Brown's Mathpages, <a href="http://www.mathpages.com/home/kmath107.htm">Partitions into Consecutive Integers</a>

%H A. Heiligenbrunner, <a href="http://ah9.at/ahsummen.htm">Sum of adjacent numbers (in German)</a>

%H Nieuw Archief voor Wiskunde 5/6 nr. 2 Problems/UWC, Problem C: <a href="http://www.jaapspies.nl/mathfiles/problem2005-2C.pdf">solution of this Problem</a>

%H J. Spies, <a href="http://www.jaapspies.nl/oeis/a111775.sage">Sage program for computing A111775</a>

%F If n is even then a(n) = A001227(n)-1 = A069283(n) otherwise a(n) = A001227(n)-2, for n > 1.

%F G.f.: Sum_{n >= 2} x^(3*n)/(1 - x^(2*n)). - _Peter Bala_, Jan 12 2021

%e a(15) = 2 because 15 = 4+5+6 and 15 = 1+2+3+4+5. The number of odd divisors of 15 is 4.

%e G.f. = x^6 + x^9 + x^10 + x^12 + x^14 + 2*x^15 + 2*x^18 + x^20 + 2*x^21 + x^22 + ...

%e a(30) = 3 because there are 3 ways to satisfy (x*(x+1)-y*(y+1))/2 = 30 when x-y>=3: x=8, y=3; x=9, y=5; and x=11, y=8. - _Bob Selcoe_, Feb 14 2014

%p A001227:= proc(n) local d, s; s := 0: for d from 1 by 2 to n do if n mod d = 0 then s:=s+1 fi: end do: return(s); end proc; A111775:= proc(n) local k; if n=1 then return(0) fi: k := A001227(n): if type(n,even) then k:=k-1 else k:=k-2 fi: return k; end proc; seq(A111775(i), i=1..150);

%t a[n_] := If[n == 1, 0, Total[Mod[Divisors[n], 2]] - Mod[n, 2] - 1];

%t a /@ Range[1, 100] (* _Jean-François Alcover_, Oct 14 2019 *)

%o (PARI) {a(n) = local(m); if( n<1, 0, sum( i=0, n, m=0; if( issquare( 1 + 8*(n + i * (i + 1)/2), &m), m\2 > i+2)))}; /* _Michael Somos_, Aug 27 2012 */

%Y Cf. A111774, A001227 (number of odd divisors), A069283.

%K easy,nonn

%O 1,15

%A _Jaap Spies_, Aug 16 2005