cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Jaap Spies, Aug 16 2005

Keywords

Comments

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.
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
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

Examples

			a(15) = 2 because 15 = 4+5+6 and 15 = 1+2+3+4+5. The number of odd divisors of 15 is 4.
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 + ...
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
		

References

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

Crossrefs

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

Programs

  • Maple
    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);
  • Mathematica
    a[n_] := If[n == 1, 0, Total[Mod[Divisors[n], 2]] - Mod[n, 2] - 1];
    a /@ Range[1, 100] (* Jean-François Alcover, Oct 14 2019 *)
  • 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 */

Formula

If n is even then a(n) = A001227(n)-1 = A069283(n) otherwise a(n) = A001227(n)-2, for n > 1.
G.f.: Sum_{n >= 2} x^(3*n)/(1 - x^(2*n)). - Peter Bala, Jan 12 2021