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.

Showing 1-10 of 13 results. Next

A001227 Number of odd divisors of n.

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 2, 1, 3, 2, 2, 2, 2, 2, 4, 1, 2, 3, 2, 2, 4, 2, 2, 2, 3, 2, 4, 2, 2, 4, 2, 1, 4, 2, 4, 3, 2, 2, 4, 2, 2, 4, 2, 2, 6, 2, 2, 2, 3, 3, 4, 2, 2, 4, 4, 2, 4, 2, 2, 4, 2, 2, 6, 1, 4, 4, 2, 2, 4, 4, 2, 3, 2, 2, 6, 2, 4, 4, 2, 2, 5, 2, 2, 4, 4, 2, 4, 2, 2, 6, 4, 2, 4, 2, 4, 2, 2, 3, 6, 3, 2, 4, 2, 2, 8
Offset: 1

Views

Author

Keywords

Comments

Also (1) number of ways to write n as difference of two triangular numbers (A000217), see A136107; (2) number of ways to arrange n identical objects in a trapezoid. - Tom Verhoeff
Also number of partitions of n into consecutive positive integers including the trivial partition of length 1 (e.g., 9 = 2+3+4 or 4+5 or 9 so a(9)=3). (Useful for cribbage players.) See A069283. - Henry Bottomley, Apr 13 2000
This has been described as Sylvester's theorem, but to reduce ambiguity I suggest calling it Sylvester's enumeration. - Gus Wiseman, Oct 04 2022
a(n) is also the number of factors in the factorization of the Chebyshev polynomial of the first kind T_n(x). - Yuval Dekel (dekelyuval(AT)hotmail.com), Aug 28 2003
Number of factors in the factorization of the polynomial x^n+1 over the integers. See also A000005. - T. D. Noe, Apr 16 2003
a(n) = 1 if and only if n is a power of 2 (see A000079). - Lekraj Beedassy, Apr 12 2005
Number of occurrences of n in A049777. - Philippe Deléham, Jun 19 2005
For n odd, n is prime if and only if a(n) = 2. - George J. Schaeffer (gschaeff(AT)andrew.cmu.edu), Sep 10 2005
Also number of partitions of n such that if k is the largest part, then each of the parts 1,2,...,k-1 occurs exactly once. Example: a(9)=3 because we have [3,3,2,1],[2,2,2,2,1] and [1,1,1,1,1,1,1,1,1]. - Emeric Deutsch, Mar 07 2006
Also the number of factors of the n-th Lucas polynomial. - T. D. Noe, Mar 09 2006
Lengths of rows of triangle A182469;
Denoted by Delta_0(n) in Glaisher 1907. - Michael Somos, May 17 2013
Also the number of partitions p of n into distinct parts such that max(p) - min(p) < length(p). - Clark Kimberling, Apr 18 2014
Row sums of triangle A247795. - Reinhard Zumkeller, Sep 28 2014
Row sums of triangle A237048. - Omar E. Pol, Oct 24 2014
A069288(n) <= a(n). - Reinhard Zumkeller, Apr 05 2015
A000203, A000593 and this sequence have the same parity: A053866. - Omar E. Pol, May 14 2016
a(n) is equal to the number of ways to write 2*n-1 as (4*x + 2)*y + 4*x + 1 where x and y are nonnegative integers. Also a(n) is equal to the number of distinct values of k such that k/(2*n-1) + k divides (k/(2*n-1))^(k/(2*n-1)) + k, (k/(2*n-1))^k + k/(2*n-1) and k^(k/(2*n-1)) + k/(2*n-1). - Juri-Stepan Gerasimov, May 23 2016, Jul 15 2016
Also the number of odd divisors of n*2^m for m >= 0. - Juri-Stepan Gerasimov, Jul 15 2016
a(n) is odd if and only if n is a square or twice a square. - Juri-Stepan Gerasimov, Jul 17 2016
a(n) is also the number of subparts in the symmetric representation of sigma(n). For more information see A279387 and A237593. - Omar E. Pol, Nov 05 2016
a(n) is also the number of partitions of n into an odd number of equal parts. - Omar E. Pol, May 14 2017 [This follows from the g.f. Sum_{k >= 1} x^k/(1-x^(2*k)). - N. J. A. Sloane, Dec 03 2020]

Examples

			G.f. = q + q^2 + 2*q^3 + q^4 + 2*q^5 + 2*q^6 + 2*q^7 + q^8 + 3*q^9 + 2*q^10 + ...
From _Omar E. Pol_, Nov 30 2020: (Start)
For n = 9 there are three odd divisors of 9; they are [1, 3, 9]. On the other hand there are three partitions of 9 into consecutive parts: they are [9], [5, 4] and [4, 3, 2], so a(9) = 3.
Illustration of initial terms:
                              Diagram
   n   a(n)                         _
   1     1                        _|1|
   2     1                      _|1 _|
   3     2                    _|1  |1|
   4     1                  _|1   _| |
   5     2                _|1    |1 _|
   6     2              _|1     _| |1|
   7     2            _|1      |1  | |
   8     1          _|1       _|  _| |
   9     3        _|1        |1  |1 _|
  10     2      _|1         _|   | |1|
  11     2    _|1          |1   _| | |
  12     2   |1            |   |1  | |
...
a(n) is the number of horizontal line segments in the n-th level of the diagram. For more information see A286001. (End)
		

References

  • B. C. Berndt, Ramanujan's Notebooks Part V, Springer-Verlag, see p. 487 Entry 47.
  • L. E. Dickson, History of the Theory of Numbers. Carnegie Institute Public. 256, Washington, DC, Vol. 1, 1919; Vol. 2, 1920; Vol. 3, 1923, see vol. 1, p. 306.
  • J. W. L. Glaisher, On the representations of a number as the sum of two, four, six, eight, ten, and twelve squares, Quart. J. Math. 38 (1907), 1-62 (see p. 4).
  • Ronald. L. Graham, Donald E. Knuth, and Oren Patashnik, Concrete Mathematics, 2nd ed. (Addison-Wesley, 1994), see exercise 2.30 on p. 65.
  • P. A. MacMahon, Combinatory Analysis, Cambridge Univ. Press, London and New York, Vol. 1, 1915 and Vol. 2, 1916; see vol. 2, p 28.

Crossrefs

If this sequence counts gapless sets by sum (by Sylvester's enumeration), these sets are ranked by A073485 and A356956. See also A055932, A066311, A073491, A107428, A137921, A333217, A356224, A356841, A356845.
Dirichlet inverse is A327276.

Programs

  • Haskell
    a001227 = sum . a247795_row
    -- Reinhard Zumkeller, Sep 28 2014, May 01 2012, Jul 25 2011
    
  • Magma
    [NumberOfDivisors(n)/Valuation(2*n, 2): n in [1..100]]; // Vincenzo Librandi, Jun 02 2019
    
  • Maple
    for n from 1 by 1 to 100 do s := 0: for d from 1 by 2 to n do if n mod d = 0 then s := s+1: fi: od: print(s); od:
    A001227 := proc(n) local a,d;
        a := 1 ;
        for d in ifactors(n)[2] do
            if op(1,d) > 2 then
                a := a*(op(2,d)+1) ;
            end if;
        end do:
        a ;
    end proc: # R. J. Mathar, Jun 18 2015
  • Mathematica
    f[n_] := Block[{d = Divisors[n]}, Count[ OddQ[d], True]]; Table[ f[n], {n, 105}] (* Robert G. Wilson v, Aug 27 2004 *)
    Table[Total[Mod[Divisors[n], 2]],{n,105}] (* Zak Seidov, Apr 16 2010 *)
    f[n_] := Block[{d = DivisorSigma[0, n]}, If[ OddQ@ n, d, d - DivisorSigma[0, n/2]]]; Array[f, 105] (* Robert G. Wilson v *)
    a[ n_] := Sum[  Mod[ d, 2], { d, Divisors[ n]}]; (* Michael Somos, May 17 2013 *)
    a[ n_] := DivisorSum[ n, Mod[ #, 2] &]; (* Michael Somos, May 17 2013 *)
    Count[Divisors[#],?OddQ]&/@Range[110] (* _Harvey P. Dale, Feb 15 2015 *)
    (* using a262045 from A262045 to compute a(n) = number of subparts in the symmetric representation of sigma(n) *)
    (* cl = current level, cs = current subparts count *)
    a001227[n_] := Module[{cs=0, cl=0, i, wL, k}, wL=a262045[n]; k=Length[wL]; For[i=1, i<=k, i++, If[wL[[i]]>cl, cs++; cl++]; If[wL[[i]]Hartmut F. W. Hoft, Dec 16 2016 *)
    a[n_] := DivisorSigma[0, n / 2^IntegerExponent[n, 2]]; Array[a, 100] (* Amiram Eldar, Jun 12 2022 *)
  • PARI
    {a(n) = sumdiv(n, d, d%2)}; /* Michael Somos, Oct 06 2007 */
    
  • PARI
    {a(n) = direuler( p=2, n, 1 / (1 - X) / (1 - kronecker( 4, p) * X))[n]}; /* Michael Somos, Oct 06 2007 */
    
  • PARI
    a(n)=numdiv(n>>valuation(n,2)) \\ Charles R Greathouse IV, Mar 16 2011
    
  • PARI
    a(n)=sum(k=1,round(solve(x=1,n,x*(x+1)/2-n)),(k^2-k+2*n)%(2*k)==0) \\ Charles R Greathouse IV, May 31 2013
    
  • PARI
    a(n)=sumdivmult(n,d,d%2) \\ Charles R Greathouse IV, Aug 29 2013
    
  • Python
    from functools import reduce
    from operator import mul
    from sympy import factorint
    def A001227(n): return reduce(mul,(q+1 for p, q in factorint(n).items() if p > 2),1) # Chai Wah Wu, Mar 08 2021
  • SageMath
    def A001227(n): return len([1 for d in divisors(n) if is_odd(d)])
    [A001227(n) for n in (1..80)]  # Peter Luschny, Feb 01 2012
    

Formula

Dirichlet g.f.: zeta(s)^2*(1-1/2^s).
Comment from N. J. A. Sloane, Dec 02 2020: (Start)
By counting the odd divisors f n in different ways, we get three different ways of writing the ordinary generating function. It is:
A(x) = x + x^2 + 2*x^3 + x^4 + 2*x^5 + 2*x^6 + 2*x^7 + x^8 + 3*x^9 + 2*x^10 + ...
= Sum_{k >= 1} x^(2*k-1)/(1-x^(2*k-1))
= Sum_{k >= 1} x^k/(1-x^(2*k))
= Sum_{k >= 1} x^(k*(k+1)/2)/(1-x^k) [Ramanujan, 2nd notebook, p. 355.].
(This incorporates comments from Vladeta Jovovic, Oct 16 2002 and Michael Somos, Oct 30 2005.) (End)
G.f.: x/(1-x) + Sum_{n>=1} x^(3*n)/(1-x^(2*n)), also L(x)-L(x^2) where L(x) = Sum_{n>=1} x^n/(1-x^n). - Joerg Arndt, Nov 06 2010
a(n) = A000005(n)/(A007814(n)+1) = A000005(n)/A001511(n).
Multiplicative with a(p^e) = 1 if p = 2; e+1 if p > 2. - David W. Wilson, Aug 01 2001
a(n) = A000005(A000265(n)). - Lekraj Beedassy, Jan 07 2005
Moebius transform is period 2 sequence [1, 0, ...] = A000035, which means a(n) is the Dirichlet convolution of A000035 and A057427.
a(n) = A113414(2*n). - N. J. A. Sloane, Jan 24 2006 (corrected Nov 10 2007)
a(n) = A001826(n) + A001842(n). - Reinhard Zumkeller, Apr 18 2006
Sequence = M*V = A115369 * A000005, where M = an infinite lower triangular matrix and V = A000005, d(n); as a vector: [1, 2, 2, 3, 2, 4, ...]. - Gary W. Adamson, Apr 15 2007
Equals A051731 * [1,0,1,0,1,...]; where A051731 is the inverse Mobius transform. - Gary W. Adamson, Nov 06 2007
a(n) = A000005(n) - A183063(n).
a(n) = d(n) if n is odd, or d(n) - d(n/2) if n is even, where d(n) is the number of divisors of n (A000005). (See the Weisstein page.) - Gary W. Adamson, Mar 15 2011
Dirichlet convolution of A000005 and A154955 (interpreted as a flat sequence). - R. J. Mathar, Jun 28 2011
a(A000079(n)) = 1; a(A057716(n)) > 1; a(A093641(n)) <= 2; a(A038550(n)) = 2; a(A105441(n)) > 2; a(A072502(n)) = 3. - Reinhard Zumkeller, May 01 2012
a(n) = 1 + A069283(n). - R. J. Mathar, Jun 18 2015
a(A002110(n)/2) = n, n >= 1. - Altug Alkan, Sep 29 2015
a(n*2^m) = a(n*2^i), a((2*j+1)^n) = n+1 for m >= 0, i >= 0 and j >= 0. a((2*x+1)^n) = a((2*y+1)^n) for positive x and y. - Juri-Stepan Gerasimov, Jul 17 2016
Conjectures: a(n) = A067742(n) + 2*A131576(n) = A082647(n) + A131576(n). - Omar E. Pol, Feb 15 2017
a(n) = A000005(2n) - A000005(n) = A099777(n)-A000005(n). - Danny Rorabaugh, Oct 03 2017
L.g.f.: -log(Product_{k>=1} (1 - x^(2*k-1))^(1/(2*k-1))) = Sum_{n>=1} a(n)*x^n/n. - Ilya Gutkovskiy, Jul 30 2018
G.f.: (psi_{q^2}(1/2) + log(1-q^2))/log(q), where psi_q(z) is the q-digamma function. - Michael Somos, Jun 01 2019
a(n) = A003056(n) - A238005(n). - Omar E. Pol, Sep 12 2021
Sum_{k=1..n} a(k) ~ n*log(n)/2 + (gamma + log(2)/2 - 1/2)*n, where gamma is Euler's constant (A001620). - Amiram Eldar, Nov 27 2022
Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k)/A000005(k) = log(2) (A002162). - Amiram Eldar, Mar 01 2023
a(n) = Sum_{i=1..n} (-1)^(i+1)*A135539(n,i). - Ridouane Oudra, Apr 13 2023

A299765 Irregular triangle read by rows, T(n,k), n >= 1, k >= 1, in which row n lists the partitions of n into consecutive parts, with the partitions ordered by increasing number of parts.

Original entry on oeis.org

1, 2, 3, 2, 1, 4, 5, 3, 2, 6, 3, 2, 1, 7, 4, 3, 8, 9, 5, 4, 4, 3, 2, 10, 4, 3, 2, 1, 11, 6, 5, 12, 5, 4, 3, 13, 7, 6, 14, 5, 4, 3, 2, 15, 8, 7, 6, 5, 4, 5, 4, 3, 2, 1, 16, 17, 9, 8, 18, 7, 6, 5, 6, 5, 4, 3, 19, 10, 9, 20, 6, 5, 4, 3, 2, 21, 11, 10, 8, 7, 6, 6, 5, 4, 3, 2, 1, 22, 7, 6, 5, 4, 23, 12, 11
Offset: 1

Views

Author

Omar E. Pol, Feb 26 2018

Keywords

Comments

In the triangle the first partition with m parts appears as the last partition in row A000217(m), m >= 1. - Omar E. Pol, Mar 23 2022
For m >= 0, row 2^m consists of just one element (2^m). - Paolo Xausa, May 24 2025

Examples

			Triangle begins:
   [1];
   [2];
   [3], [2, 1];
   [4];
   [5], [3, 2];
   [6], [3, 2, 1];
   [7], [4, 3];
   [8];
   [9], [5, 4], [4, 3, 2];
  [10], [4, 3, 2, 1];
  [11], [6, 5];
  [12], [5, 4, 3];
  [13], [7, 6];
  [14], [5, 4, 3, 2];
  [15], [8, 7], [6, 5, 4], [5, 4, 3, 2, 1];
  [16];
  [17], [9, 8];
  [18], [7, 6, 5], [6, 5, 4, 3];
  [19], [10, 9];
  [20], [6, 5, 4, 3, 2];
  [21], [11, 10], [8, 7, 6], [6, 5, 4, 3, 2, 1];
  [22], [7, 6, 5, 4];
  [23], [12, 11];
  [24], [9, 8, 7];
  [25], [13, 12], [7, 6, 5, 4, 3];
  [26], [8, 7, 6, 5];
  [27], [14, 13], [10, 9, 8], [7, 6, 5, 4, 3, 2];
  [28], [7, 6, 5, 4, 3, 2, 1];
...
Note that in the below diagram the number of horizontal line segments in the n-th row equals A001227(n), the number of partitions of n into consecutive parts, so we can find the partitions of n into consecutive parts as follows: consider the vertical blocks of numbers that start exactly in the n-th row of the diagram, for example: for n = 15 consider the vertical blocks of numbers that start exactly in the 15th row. They are [15], [8, 7], [6, 5, 4] and [5, 4, 3, 2, 1], equaling the 15th row of the above triangle.
.                                                           _
.                                                         _|1|
.                                                       _|2 _|
.                                                     _|3  |2|
.                                                   _|4   _|1|
.                                                 _|5    |3 _|
.                                               _|6     _|2|3|
.                                             _|7      |4  |2|
.                                           _|8       _|3 _|1|
.                                         _|9        |5  |4 _|
.                                       _|10        _|4  |3|4|
.                                     _|11         |6   _|2|3|
.                                   _|12          _|5  |5  |2|
.                                 _|13           |7    |4 _|1|
.                               _|14            _|6   _|3|5 _|
.                             _|15             |8    |6  |4|5|
.                           _|16              _|7    |5  |3|4|
.                         _|17               |9     _|4 _|2|3|
.                       _|18                _|8    |7  |6  |2|
.                     _|19                 |10     |6  |5 _|1|
.                   _|20                  _|9     _|5  |4|6 _|
.                 _|21                   |11     |8   _|3|5|6|
.               _|22                    _|10     |7  |7  |4|5|
.             _|23                     |12      _|6  |6  |3|4|
.           _|24                      _|11     |9    |5 _|2|3|
.         _|25                       |13       |8   _|4|7  |2|
.       _|26                        _|12      _|7  |8  |6 _|1|
.     _|27                         |14       |10   |7  |5|7 _|
.    |28                           |13       |9    |6  |4|6|7|
...
The diagram is infinite. For more information about the diagram see A286000.
For an amazing connection with sum of divisors function (A000203) see A237593.
		

Crossrefs

Row n has length A204217(n).
Row sums give A245579.
Right border gives A118235.
Column 1 gives A000027.
Records give A000027.
The number of partitions into consecutive parts in row n is A001227(n).
For tables of partitions into consecutive parts see A286000 and A286001.
Cf. A328365 (mirror).
Cf. A352425 (a subsequence).

Programs

  • Mathematica
    intervals[n_]:=Module[{x,y},SolveValues[(x^2-y^2+x+y)/2==n&&0A299765row[n_]:=Flatten[SortBy[Map[Range[First[#],Last[#],-1]&,intervals[n]],Length]];
    nrows=25;Array[A299765row,nrows] (* Paolo Xausa, Jun 19 2022 *)
  • PARI
    iscons(p) = my(v = vector(#p-1, k, p[k+1] - p[k])); v == vector(#p-1, i, 1);
    row(n) = my(list = List()); forpart(p=n, if (iscons(p), listput(list, Vecrev(p)));); Vec(list); \\ Michel Marcus, May 11 2022

Extensions

Name clarified by Omar E. Pol, May 11 2022

A109814 a(n) is the largest k such that n can be written as sum of k consecutive positive integers.

Original entry on oeis.org

1, 1, 2, 1, 2, 3, 2, 1, 3, 4, 2, 3, 2, 4, 5, 1, 2, 4, 2, 5, 6, 4, 2, 3, 5, 4, 6, 7, 2, 5, 2, 1, 6, 4, 7, 8, 2, 4, 6, 5, 2, 7, 2, 8, 9, 4, 2, 3, 7, 5, 6, 8, 2, 9, 10, 7, 6, 4, 2, 8, 2, 4, 9, 1, 10, 11, 2, 8, 6, 7, 2, 9, 2, 4, 10, 8, 11, 12, 2, 5, 9, 4, 2, 8, 10, 4, 6, 11, 2, 12, 13, 8, 6, 4, 10, 3, 2, 7, 11, 8, 2, 12
Offset: 1

Views

Author

Keywords

Comments

n is the sum of at most a(n) consecutive positive integers. As suggested by David W. Wilson, Aug 15 2005: 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 d of n there is a unique corresponding k = min(d,2n/d). a(n) is the largest among those k. - Jaap Spies, Aug 16 2005
The numbers that can be written as a sum of k consecutive positive integers are those in column k of A141419 (as a triangle). - Peter Munn, Mar 01 2019
The numbers that cannot be written as a sum of two or more consecutive positive integers are the powers of 2. So a(n) = 1 iff n = 2^k for k >= 0. - Bernard Schott, Mar 03 2019

Examples

			Examples provided by _Rainer Rosenthal_, Apr 01 2008:
1 = 1     ---> a(1) = 1
2 = 2     ---> a(2) = 1
3 = 1+2   ---> a(3) = 2
4 = 4     ---> a(4) = 1
5 = 2+3   ---> a(5) = 2
6 = 1+2+3 ---> a(6) = 3
a(15) = 5: 15 = 15 (k=1), 15 = 7+8 (k=2), 15 = 4+5+6 (k=3) and 15 = 1+2+3+4+5 (k=5). - _Jaap Spies_, Aug 16 2005
		

Crossrefs

Cf. A000079 (powers of 2), A000217 (triangular numbers).

Programs

  • Maple
    A109814:= proc(n) local m, k, d; m := 0; for d from 1 by 2 to n do if n mod d = 0 then k := min(d, 2*n/d): fi; if k > m then m := k fi: od; return(m); end proc; seq(A109814(i),i=1..150); # Jaap Spies, Aug 16 2005
  • Mathematica
    a[n_] := Reap[Do[If[OddQ[d], Sow[Min[d, 2n/d]]], {d, Divisors[n]}]][[2, 1]] // Max; Table[a[n], {n, 1, 102}]
  • Python
    from sympy import divisors
    def a(n): return max(min(d, 2*n//d) for d in divisors(n) if d&1)
    print([a(n) for n in range(1, 103)]) # Michael S. Branicky, Dec 23 2022
  • Sage
    [sloane.A109814(n) for n in range(1,20)]
    # Jaap Spies, Aug 16 2005
    

Formula

From Reinhard Zumkeller, Apr 18 2006: (Start)
a(n)*(a(n)+2*A118235(n)-1)/2 = n;
a(A000079(n)) = 1;
a(A000217(n)) = n. (End)

Extensions

Edited by N. J. A. Sloane, Aug 23 2008 at the suggestion of R. J. Mathar

A328365 Irregular triangle read by rows, T(n,k), n >= 1, k >= 1, in which row n lists in reverse order the partitions of n into consecutive parts.

Original entry on oeis.org

1, 2, 1, 2, 3, 4, 2, 3, 5, 1, 2, 3, 6, 3, 4, 7, 8, 2, 3, 4, 4, 5, 9, 1, 2, 3, 4, 10, 5, 6, 11, 3, 4, 5, 12, 6, 7, 13, 2, 3, 4, 5, 14, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 15, 16, 8, 9, 17, 3, 4, 5, 6, 5, 6, 7, 18, 9, 10, 19, 2, 3, 4, 5, 6, 20, 1, 2, 3, 4, 5, 6, 6, 7, 8, 10, 11, 21, 4, 5, 6, 7, 22, 11, 12, 23, 7, 8, 9, 24
Offset: 1

Views

Author

Omar E. Pol, Oct 22 2019

Keywords

Comments

For m >= 0, row 2^m consists of just one element (2^m). - Paolo Xausa, May 24 2025

Examples

			Triangle begins:
  [1];
  [2];
  [1, 2], [3];
  [4];
  [2, 3], [5];
  [1, 2, 3], [6];
  [3, 4], [7];
  [8];
  [2, 3, 4], [4, 5], [9];
  [1, 2, 3, 4], [10];
  [5, 6], [11];
  [3, 4, 5], [12];
  [6, 7], [13];
  [2, 3, 4, 5], [14];
  [1, 2, 3, 4, 5], [4, 5, 6], [7, 8], [15];
  [16];
  [8, 9], [17];
  [3, 4, 5, 6], [5, 6, 7], [18];
  [9, 10], [19];
  [2, 3, 4, 5, 6], [20];
  [1, 2, 3, 4, 5, 6], [6, 7, 8], [10, 11], [21];
  [4, 5, 6, 7], [22];
  [11, 12], [23];
  [7, 8, 9], [24];
  [3, 4, 5, 6, 7], [12, 13], [25];
  [5, 6, 7, 8], [26];
  [2, 3, 4, 5, 6, 7], [8, 9, 10], [13, 14], [27];
  [1, 2, 3, 4, 5, 6, 7], [28];
  ...
For n = 9 there are three partitions of 9 into consecutive parts, they are [9], [5, 4], [4, 3, 2], so the 9th row of triangle is [2, 3, 4], [4, 5], [9].
Note that in the below diagram the number of horizontal line segments in the n-th row equals A001227(n), the number of partitions of n into consecutive parts, so we can find the partitions of n into consecutive parts as follows: consider the vertical blocks of numbers that start exactly in the n-th row of the diagram, for example: for n = 15 consider the vertical blocks of numbers that start exactly in the 15th row. They are [1, 2, 3, 4, 5], [4, 5, 6], [7, 8], [15], equaling the 15th row of the above triangle.
Row        _
  1       |1|_
  2       |_ 2|_
  3       |1|  3|_
  4       |2|_   4|_
  5       |_ 2|    5|_
  6       |1|3|_     6|_
  7       |2|  3|      7|_
  8       |3|_ 4|_       8|_
  9       |_ 2|  4|        9|_
  10      |1|3|  5|_        10|_
  11      |2|4|_   5|         11|_
  12      |3|  3|  6|_          12|_
  13      |4|_ 4|    6|           13|_
  14      |_ 2|5|_   7|_            14|_
  15      |1|3|  4|    7|             15|_
  16      |2|4|  5|    8|_              16|_
  17      |3|5|_ 6|_     8|               17|_
  18      |4|  3|  5|    9|_                18|_
  19      |5|_ 4|  6|      9|                 19|_
  20      |_ 2|5|  7|_    10|_                  20|_
  21      |1|3|6|_   6|     10|                   21|_
  22      |2|4|  4|  7|     11|_                    22|_
  23      |3|5|  5|  8|_      11|                     23|_
  24      |4|6|_ 6|    7|     12|_                      24|_
  25      |5|  3|7|_   8|       12|                       25|_
  26      |6|_ 4|  5|  9|_      13|_                        26|_
  27      |_ 2|5|  6|    8|       13|                         27|_
  28      |1|3|6|  7|    9|       14|                           28|
  ...
The diagram is infinite. For more information about the diagram see A286001.
For an amazing connection with sum of divisors function (A000203) see A237593.
		

Crossrefs

Mirror of A299765.
Row n has length A204217(n).
Row sums give A245579.
Column 1 gives A118235.
Right border gives A000027.
Records give A000027.
Where records occur gives A285899.
The number of partitions into consecutive parts in row n is A001227(n).
For tables of partitions into consecutive parts see A286000 and A286001.

Programs

  • Mathematica
    Table[With[{h = Floor[n/2] - Boole[EvenQ@ n]},Append[Array[Which[Total@ # == n, #, Total@ Most@ # == n, Most[#], True, Nothing] &@ NestWhile[Append[#, #[[-1]] + 1] &, {#}, Total@ # <= n &, 1, h - # + 1] &, h], {n}]], {n, 24}] // Flatten (* Michael De Vlieger, Oct 22 2019 *)

A212652 a(n) is the least positive integer M such that n = T(M) - T(k), for k an integer, 0 <= k <= M, where T(r) = A000217(r) is the r-th triangular number.

Original entry on oeis.org

1, 2, 2, 4, 3, 3, 4, 8, 4, 4, 6, 5, 7, 5, 5, 16, 9, 6, 10, 6, 6, 7, 12, 9, 7, 8, 7, 7, 15, 8, 16, 32, 8, 10, 8, 8, 19, 11, 9, 10, 21, 9, 22, 9, 9, 13, 24, 17, 10, 12, 11, 10, 27, 10, 10, 11, 12, 16, 30, 11, 31, 17, 11, 64, 11, 11, 34
Offset: 1

Views

Author

L. Edson Jeffery, Feb 14 2013

Keywords

Comments

n = A000217(a(n)) - A000217(a(n) - A109814(n)).
Conjecture: n appears in row a(n) of A209260.
From Daniel Forgues, Jan 06 2016: (Start)
n = Sum_{i=k+1..M} i = T(M) - T(k) = (M-k)*(M+k+1)/2.
n = 2^m, m >= 0, iff M = n = 2^m and k = n - 1 = 2^m - 1. (Points on line with slope 1.) (Powers of 2 can't be the sum of consecutive numbers.)
n is odd prime iff k = M-2. Thus M = (n+1)/2 when n is odd prime. (Points on line with slope 1/2.) (Odd primes can't be the sum of more than 2 consecutive numbers.) (End)
If n = 2^m*p where p is an odd prime, then a(n) = 2^m + (p-1)/2. - Robert Israel, Jan 14 2016
This also expresses the following geometry: along a circle having (n) points on its circumference, a(n) expresses the minimum number of hops from a start point, in a given direction (CW or CCW), when each hop is increased by one, before returning to a visited point. For example, on a clock (n=12), starting at 12 (same as zero), the hops would lead to the points 1, 3, 6, 10 and then 3, which was already visited: 5 hops altogether, so a(12) = 5. - Joseph Rozhenko, Dec 25 2023
Conjecture: a(n) is the smallest of the largest parts of the partitions of n into consecutive parts. - Omar E. Pol, Jan 07 2025

Examples

			For n = 63, we have D(63) = {1,3,7,9,21,63}, B_63 = {11,12,13,22,32,63} and a(63) = min(11,12,13,22,32,63) = 11. Since A109814(63) = 9, T(11) - T(11-9) = T(11) - T(2) = 66 - 3 = 63.
		

Crossrefs

Programs

  • Maple
    f:= n ->  min(map(t -> n/t + (t-1)/2,
    numtheory:-divisors(n/2^padic:-ordp(n,2)))):
    map(f, [$1..100]); # Robert Israel, Jan 14 2016
  • Mathematica
    Table[Min[n/# + (# - 1)/2 &@ Select[Divisors@ n, OddQ]], {n, 67}] (* Michael De Vlieger, Dec 11 2015 *)
  • PARI
    { A212652(n) = my(m); m=2*n+1; fordiv(n/2^valuation(n,2), d, m=min(m,d+(2*n)\d)); (m-1)\2; } \\ Max Alekseyev, Mar 31 2008

Formula

a(n) = Min_{odd d|n} (n/d + (d-1)/2).
a(n) = A218621(n) + (n/A218621(n) - 1)/2.
a(n) = A109814(n) + A118235(n) - 1.

Extensions

Reference to Max Alekseyev's 2008 proposal of this sequence added by N. J. A. Sloane, Nov 01 2014

A104512 a(n) is the minimum number that is the first of k > 1 consecutive integers whose sum equals n, or 0 if impossible.

Original entry on oeis.org

0, 0, 1, 0, 2, 1, 3, 0, 2, 1, 5, 3, 6, 2, 1, 0, 8, 3, 9, 2, 1, 4, 11, 7, 3, 5, 2, 1, 14, 4, 15, 0, 3, 7, 2, 1, 18, 8, 4, 6, 20, 3, 21, 2, 1, 10, 23, 15, 4, 8, 6, 3, 26, 2, 1, 5, 7, 13, 29, 4, 30, 14, 3, 0, 2, 1, 33, 5, 9, 7, 35, 4, 36, 17, 3, 6, 2, 1, 39, 14, 5, 19, 41, 7, 4, 20, 12, 3, 44, 2, 1, 8, 13
Offset: 1

Views

Author

Alfred S. Posamentier (asp2(AT)juno.com) and Robert G. Wilson v, Feb 23 2005

Keywords

Examples

			a(18) = 3 because 3+4+5+6 = 5+6+7 = 18 but 3 < 5.
		

References

  • Alfred S. Posamentier, Math Charmers, Tantalizing Tidbits for the Mind, Prometheus Books, NY, 2003, page 67.

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{r = Ceiling[n/2]}, If[ IntegerQ[ Log[2, n]], 0, m = Range[r]; lst = Flatten[ Table[ m[[k]], {i, r}, {j, i + 1, r}, {k, i, j}], 1]; lst[[ Position[ Plus @@@ lst, n, 1, 1][[1, 1]], 1]]]]; Table[ f[n], {n, 93}] (* Robert G. Wilson v, Feb 25 2005 *)
  • PARI
    A104512(n) = if(!bitand(n,n-1), 0, my(b,d,u=1+sqrtint(2*n)); for(k=0,n-2,b = binomial(k+1,2); forstep(j=min(n,k+u),k+2,-1, d = binomial(j+1,2) - b; if(d==n,return(1+k),if(dAntti Karttunen, Mar 30 2021

Formula

a(n)=0 iff n=2^k.
a(n)=1 iff n is a triangular number (A000217).

A138796 Least possible k > 0 with T(k) - T(j) = n, j > 0, where T(i) > 0 are the triangular numbers A000217.

Original entry on oeis.org

2, 3, 4, 3, 6, 4, 8, 4, 10, 6, 5, 7, 5, 6, 16, 9, 6, 10, 6, 8, 7, 12, 9, 7, 8, 7, 28, 15, 8, 16, 32, 8, 10, 8, 13, 19, 11, 9, 10, 21, 9, 22, 9, 10, 13, 24, 17, 10, 12, 11, 10, 27, 10, 13, 11, 12, 16, 30, 11, 31, 17, 11, 64, 11, 18, 34, 12, 14, 13, 36, 12, 37, 20, 12, 13, 12, 21, 40, 18
Offset: 2

Views

Author

Peter Pein (petsie(AT)dordos.net), Mar 30 2008

Keywords

Comments

For T(k) see A138797, for j see A138798 and for T(j) see A138799.
The number of ways n can be written as difference of two triangular numbers is sequence A136107
Note that n = t(k)-t(j) implies 2n = (k-j)(k+j+1), where (k-j) and (k+j+1) are of opposite parity. Let d be the odd element of { k-j, k+j+1 }. Then d is an odd divisor of n and k = ( d + 2n/d - 1 ) / 2. Therefore a(n) = ( min{ d + 2n/d } - 1 ) / 2 where d runs through all odd divisors of n, except perhaps (sqrt(8*n+1) +- 1)/2 which correspond to j=0. See PARI program. The restriction that j > 0 seems artificial. If it is removed we get A212652. - Max Alekseyev, Mar 31 2008

Examples

			a(30)=8, because 30 = T(30) - T(29) = T(11) - T(8) = T(9) - T(5) = T(8) - T(3) and 8 is the least index of the minuends.
		

Crossrefs

Programs

  • Mathematica
    T=#(#+1)/2&;Min[k/.{ToRules[Reduce[{T[k]-T[j]\[Equal]#,0
    				
  • PARI
    { a(n) = local(m); m=2*n+1; fordiv(n/2^valuation(n,2),d,if((2*d+1)^2!=8*n+1&&(2*d-1)^2!=8*n+1,m=min(m,d+(2*n)\d))); (m-1)\2 }
    vector(100,n,a(n)) \\ Max Alekseyev, Mar 31 2008

A138797 Least possible T(k) with T(k)-T(j)=n, where T(i)>0 are the triangular numbers A000217.

Original entry on oeis.org

3, 6, 10, 6, 21, 10, 36, 10, 55, 21, 15, 28, 15, 21, 136, 45, 21, 55, 21, 36, 28, 78, 45, 28, 36, 28, 406, 120, 36, 136, 528, 36, 55, 36, 91, 190, 66, 45, 55, 231, 45, 253, 45, 55, 91, 300, 153, 55, 78, 66, 55, 378, 55, 91, 66, 78, 136, 465, 66, 496, 153, 66, 2080, 66, 171
Offset: 2

Views

Author

Peter Pein (petsie(AT)dordos.net), Mar 30 2008

Keywords

Comments

For k see A138796, for j see A138798 and for T(j) see A138799.
The number of ways n can be written as difference of two triangular numbers is sequence A136107

Examples

			a(4)=10 because T(A138796(4))=10.
		

Crossrefs

Programs

  • Mathematica
    T=#(#+1)/2&;T[Min[k/.{ToRules[Reduce[{T[k]-T[j]\[Equal]#,0
    				

A138798 Values of j corresponding to least possible k>0 with T(k)-T(j)=n, where T(i)>0 are the triangular numbers A000217.

Original entry on oeis.org

1, 2, 3, 1, 5, 2, 7, 1, 9, 4, 2, 5, 1, 3, 15, 7, 2, 8, 1, 5, 3, 10, 6, 2, 4, 1, 27, 13, 3, 14, 31, 2, 6, 1, 10, 17, 7, 3, 5, 19, 2, 20, 1, 4, 9, 22, 14, 3, 7, 5, 2, 25, 1, 8, 4, 6, 12, 28, 3, 29, 13, 2, 63, 1, 14, 32, 4, 8, 6, 34, 3, 35, 16, 2, 5, 1, 17, 38, 13, 4, 18, 40, 6, 3, 19, 11, 2, 43, 1
Offset: 2

Views

Author

Peter Pein (petsie(AT)dordos.net), Mar 30 2008

Keywords

Comments

For k see A138796, for T(k) see A138797 and for T(j) see A138799.
The number of ways n can be written as difference of two triangular numbers is sequence A136107

Examples

			a(30)=3 because 30 = T(30)-T(29)=T(11)-T(8)=T(9)-T(5)=T(8)-T(3) and 3 is the least index of the subtrahends.
		

Crossrefs

Programs

  • Mathematica
    T=#(#+1)/2&;Sort[{k,j}/.{ToRules[Reduce[{T[k]-T[j]\[Equal]#,0
    				

A138799 Values of T(j) corresponding to least possible T(k) with T(k)-T(j)=n, where T(i)>0 are the triangular numbers A000217.

Original entry on oeis.org

1, 3, 6, 1, 15, 3, 28, 1, 45, 10, 3, 15, 1, 6, 120, 28, 3, 36, 1, 15, 6, 55, 21, 3, 10, 1, 378, 91, 6, 105, 496, 3, 21, 1, 55, 153, 28, 6, 15, 190, 3, 210, 1, 10, 45, 253, 105, 6, 28, 15, 3, 325, 1, 36, 10, 21, 78, 406, 6, 435, 91, 3, 2016, 1, 105, 528, 10, 36, 21, 595, 6, 630
Offset: 2

Views

Author

Peter Pein (petsie(AT)dordos.net), Mar 30 2008

Keywords

Comments

For k see A138796, for T(k) see A138797 and for j see A138798.
The number of ways n can be written as difference of two triangular numbers is sequence A136107

Examples

			a(30)=6 because 30 = T(30)-T(29)=T(11)-T(8)=T(9)-T(5)=T(8)-T(3) and T(3)=6 is the least minuend.
		

Crossrefs

Programs

  • Mathematica
    T=#(#+1)/2&;T[Sort[{k,j}/.{ToRules[Reduce[{T[k]-T[j]\[Equal]#,0
    				
Showing 1-10 of 13 results. Next