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-6 of 6 results.

A333530 Make a list of triples [n,k,m] with n>=1, k>=1, and T_n+T_k = T_m as in A309507, arranged in lexicographic order; sequence gives values of k.

Original entry on oeis.org

2, 5, 9, 3, 6, 14, 5, 9, 20, 27, 10, 35, 4, 6, 13, 21, 44, 8, 26, 54, 14, 20, 65, 17, 24, 77, 9, 44, 90, 5, 11, 14, 18, 33, 51, 104, 21, 38, 119, 135, 12, 22, 49, 75, 152, 14, 25, 55, 84, 170, 35, 45, 189, 6, 11, 26, 39, 50, 68, 209, 9, 15, 29, 35, 75, 114, 230, 17, 252
Offset: 1

Views

Author

N. J. A. Sloane, Apr 01 2020

Keywords

Examples

			The first few triples are:
2, 2, 3
3, 5, 6
4, 9, 10
5, 3, 6
5, 6, 8
5, 14, 15
6, 5, 8
6, 9, 11
6, 20, 21
7, 27, 28
8, 10, 13
8, 35, 36
9, 4, 10
9, 6, 11
9, 13, 16
9, 21, 23
9, 44, 45
10, 8, 13
10, 26, 28
10, 54, 55
11, 14, 18
11, 20, 23
11, 65, 66
12, 17, 21
12, 24, 27
12, 77, 78
...
		

Crossrefs

If we only take triples [n,k,m] with n <= k <= m, the values of k and m are A198455 and A198456 respectively.

Programs

  • Maple
    # This program produces the triples for each value of n, but then they need to be sorted on k:
    with(numtheory):
    A:=[]; M:=100;
    for n from 1 to M do
    TT:=n*(n+1);
    dlis:=divisors(TT);
      for d in dlis do
    if (d mod 2) = 1 then e := TT/d;
    mi:=min(d,e); ma:=max(d,e);
    k:=(ma-mi-1)/2;
    m:=(ma+mi-1)/2;
    # skip if k=0
        if k>0 then
         lprint(n,k,m);
        fi;
    fi;
    od:
    od:

A333531 Make a list of triples [n,k,m] with n>=1, k>=1, and T_n+T_k = T_m as in A309507, arranged in lexicographic order; sequence gives values of m.

Original entry on oeis.org

3, 6, 10, 6, 8, 15, 8, 11, 21, 28, 13, 36, 10, 11, 16, 23, 45, 13, 28, 55, 18, 23, 66, 21, 27, 78, 16, 46, 91, 15, 18, 20, 23, 36, 53, 105, 26, 41, 120, 136, 21, 28, 52, 77, 153, 23, 31, 58, 86, 171, 40, 49, 190, 21, 23, 33, 44, 54, 71, 210, 23, 26, 36, 41, 78, 116, 231, 28, 253
Offset: 1

Views

Author

N. J. A. Sloane, Apr 01 2020

Keywords

Examples

			The first few triples are:
2, 2, 3
3, 5, 6
4, 9, 10
5, 3, 6
5, 6, 8
5, 14, 15
6, 5, 8
6, 9, 11
6, 20, 21
7, 27, 28
8, 10, 13
8, 35, 36
9, 4, 10
9, 6, 11
9, 13, 16
9, 21, 23
9, 44, 45
10, 8, 13
10, 26, 28
10, 54, 55
11, 14, 18
11, 20, 23
11, 65, 66
12, 17, 21
12, 24, 27
12, 77, 78
...
		

Crossrefs

If we only take triples [n,k,m] with n <= k <= m, the values of k and m are A198455 and A198456 respectively.

Programs

  • Maple
    # This program produces the triples for each value of n, but then they need to be sorted on k:
    with(numtheory):
    A:=[]; M:=100;
    for n from 1 to M do
    TT:=n*(n+1);
    dlis:=divisors(TT);
    for d in dlis do
    if (d mod 2) = 1 then e := TT/d;
    mi:=min(d,e); ma:=max(d,e);
    k:=(ma-mi-1)/2;
    m:=(ma+mi-1)/2;
    # skip if k=0
    if k>0 then
    lprint(n,k,m);
    fi;
    fi;
    od:
    od:

A082183 Smallest k > 0 such that T(n) + T(k) = T(m), for some m, T(i) being the triangular numbers, n > 1.

Original entry on oeis.org

2, 5, 9, 3, 5, 27, 10, 4, 8, 14, 17, 9, 5, 21, 135, 12, 14, 35, 6, 9, 17, 30, 12, 18, 10, 7, 54, 21, 23, 495, 42, 14, 26, 8, 49, 27, 15, 20, 98, 30, 32, 80, 9, 19, 35, 62, 45, 17, 20, 14, 99, 39, 10, 18, 54, 24, 44, 78, 81, 45, 25, 85, 153, 11, 50, 125, 20, 29, 53, 94, 97
Offset: 2

Views

Author

Ralf Stephan, Apr 06 2003

Keywords

Comments

For 16 years this entry stood with no upper bound, and indeed with no proof that a(n) always existed. In February 2020 the following three bounds and formulas arrived. They are listed in chronological order. Here k = k(n) denotes the smallest number such that T(n)+T(k) is a triangular number T(m) for some m = m(n). - N. J. A. Sloane, Feb 22 2020
k = T(n) - 1 is an upper bound on k(n) = a(n). For T(k) makes a huge triangle; all the elements of the T(n) triangle can be thinly plated onto the side of the big one as a single additional row, producing T(k+1) with m = k+1. - Allan C. Wechsler, Feb 19 2020
Let Q be the largest odd number < n dividing T(n). Then T(n) is the sum of Q consecutive integers, the last Q rows of the triangle T(m) with m = T(n)/Q + (Q-1)/2, giving the upper bound k <= T(n)/Q - (Q+1)/2. [This bound is now A332554, the values of Q are in A332547.] This bound is not tight: for n=9 it gives a(9) <= 6 when in fact a(9) = 4. - Michael J. Collins, Feb 19 2020
Comments from Richard C. Schroeppel, Feb 19 2020: (Start)
2T(n) = 2T(m) - 2T(k) = m^2 + m - k^2 - k = (m-k) (m + k + 1). Now (m-k) and (m+k+1) are of opposite parity. Factor 2T(n) into the product of an odd number times an even number. We can take one of these to be m-k, and the other to be m+k+1.
The factorization 2T(n) = n^2 + n gives two obvious solutions, n * (n+1) and 1 * (n^2+n). Equating these to (m-k) * (m+k+1) gives the two "trivial" solutions k=0, m=n and k=T(n)-1, m=T(n).
Unless n is a Mersenne prime, or n+1 is a Fermat prime [these are the n such that Q=1, see A068194] there will be a nontrivial odd divisor of n(n+1) other than 1, n, or n+1. Select the odd divisor d logarithmicly closest to n + 1/2 that isn't n or n+1.
Let q be the quotient n(n+1)/q. Then m-k = min(d,q) and m+k+1 = max(d,q). Solve for k, which is the required minimum k(n) = a(n).
Example: n=5, T(n)=15, 2T(n)=30 = 3*10, d=3, q=10, k=3, m=6, 15+6 = 21. (End)

Crossrefs

Cf. A000217, A072522, values of m are in A082184, A332547.
A332554 is an upper bound on a(n).
See A055527 for a very similar sequence involving Pythagorean triples. - Bradley Klee, Feb 20 2020
See also A309332 (number of ways to write a triangular number as a sum of two triangular numbers), A309507 (... as a difference ...).

Programs

  • Maple
    f:= proc(n) local e,t,te;
         t:= n*(n+1);
         e:= padic:-ordp(t,2);
         te:= 2^e;
         min(map(d -> (abs(te*d-t/(te*d))-1)/2, numtheory:-divisors(t/te)) minus {0}):
    map(f, [$2..100]); # Robert Israel, Sep 15 2017
  • Mathematica
    Table[SelectFirst[Range[10^3], Function[m, PolygonalNumber@ Floor@ Sqrt[2 m] == m][PolygonalNumber[n] + PolygonalNumber[#]] &], {n, 2, 72}] (* Michael De Vlieger, Sep 19 2017, after Maple by Robert Israel *)
  • PARI
    for(n=2, 100, t=n*(n+1)/2; for(k=1, 10^9, u=t+k*(k+1)/2; v=floor(sqrt(2*u)); if(v*(v+1)/2==u, print1(k", "); break)))
    
  • Python
    from _future_ import division
    from sympy import divisors
    def A082183(n):
        t = n*(n+1)
        ds = divisors(t)
        for i in range(len(ds)//2-2,-1,-1):
            x = ds[i]
            y = t//x
            a, b = divmod(y-x,2)
            if b:
                return a
        return -1 # Chai Wah Wu, Sep 12 2017

Extensions

Entry updated by N. J. A. Sloane, Feb 22 2020

A333529 Number of triples [n,k,m] with n <= k <= m satisfying T_n + T_k = T_m, where T_i = i*(i+1)/2 are the triangular numbers.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Mar 31 2020

Keywords

Comments

a(n)=1 if n is in A068194. - Robert Israel, Apr 03 2020

Examples

			There is a list of all triples (including those with 0 < k < n) with n <= 16 in A309507.
		

Crossrefs

A309507 counts all triples with k>0.

Programs

  • Maple
    with(numtheory):
    A:=[]; M:=150; ct:=Array(0..M,0):
    for n from 1 to M do
    TT:=n*(n+1);
    dlis:=divisors(TT);
      for d in dlis do
    if (d mod 2) = 1 then e := TT/d;
    mi:=min(d,e); ma:=max(d,e);
    k:=(ma-mi-1)/2; m:=(ma+mi-1)/2;
    # skip if k=n then
        ct[n]:=ct[n]+1;
        lprint(n,k,m);
        fi;
    fi;
    od:
    od:
    [seq(ct[n],n=1..M)];
    # alternative:
    f:= proc(n) local t,t0, r, dmax, divs;
        t:= n*(n+1);
        r:= padic:-ordp(t,2);
        t0:= t/2^r;
        dmax:= floor((sqrt(8*t+1)-1)/2-n);
        divs:= numtheory:-divisors(t0);
        nops(select(`<=`,divs,dmax)) + nops(select(`<=`,divs,dmax/2^r))
    end proc:
    map(f, [$1..200]); # Robert Israel, Apr 03 2020
  • Mathematica
    T[n_] := n(n+1)/2;
    r[n_] := Reduce[n <= k <= m && T[n] + T[k] == T[m], {k, m}, Integers];
    a[n_] := Module[{rn = r[n], r0}, r0 = rn[[0]]; Which[r0 === Or, Length[rn], r0 === And, 1, rn === False, 0, True, Print["error ", n, " ", rn]]];
    Array[a, 100] (* Jean-François Alcover, Jun 08 2020 *)

A309332 Number of ways the n-th triangular number T(n) = A000217(n) can be written as the sum of two positive triangular numbers.

Original entry on oeis.org

0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 2, 0, 3, 0, 0, 1, 1, 3, 0, 0, 1, 0, 1, 0, 0, 3, 1, 1, 0, 1, 3, 0, 1, 1, 1, 2, 0, 1, 2, 0, 1, 1, 2, 1, 1, 1, 1, 2, 1, 0, 3, 1, 1, 1, 0, 3, 1, 1, 0, 0, 2, 0, 1, 1, 1, 1, 1, 5, 0, 1, 1, 0, 1, 0, 0, 3, 0, 3, 1, 0, 3, 1, 3, 1, 3, 3, 0, 1, 0, 0, 3, 0, 2, 0, 1
Offset: 1

Views

Author

Alois P. Heinz, Aug 01 2019

Keywords

Comments

The order doesn't matter. 21 = 6+15 = 15+6 are not counted as distinct solutions. - N. J. A. Sloane, Feb 22 2020

Examples

			a(3) = 1: 2*3/2 + 2*3/2 = 3*4/2.
a(21) = 2: 6*7/2 + 20*21/2 = 12*13/2 + 17*18/2 = 21*22/2.
a(23) = 3: 9*10/2 + 21*22/2 = 11*12/2 + 20*21/2 = 14*15/2 + 18*19/2 = 23*24/2.
		

Crossrefs

Cf. A000217, A001652, A012132, A027861, A046080 (the same for squares), A053141, A062301 (the same for primes), A108769, A309507.

Programs

  • Maple
    a:= proc(n) local h, j, r, w; h, r:= n*(n+1), 0;
          for j from n-1 by -1 do w:= j*(j+1);
            if 2*w
    				
  • Mathematica
    a[n_] := Module[{h = n(n+1), j, r = 0, w}, For[j = n-1, True, j--, w = j(j+1); If[2w < h, Break[]]; If[ IntegerQ[Sqrt[4(h-w)+1]], r++]]; r];
    Table[a[n], {n, 1, 120}] (* Jean-François Alcover, Nov 16 2022, after Alois P. Heinz *)

Formula

a(n) > 0 <=> n in { A012132 }.
a(n) = 0 <=> n in { A027861 }.
a(n) = 1 <=> n in { A108769 }.

A330657 Number of ways the n-th pentagonal number A000326(n) can be written as the difference of two positive pentagonal numbers.

Original entry on oeis.org

0, 0, 0, 1, 1, 0, 2, 0, 0, 1, 0, 1, 1, 1, 0, 1, 2, 0, 2, 1, 1, 3, 1, 0, 2, 3, 0, 3, 1, 1, 2, 1, 1, 1, 2, 1, 3, 1, 2, 2, 1, 2, 1, 1, 1, 1, 3, 2, 2, 2, 1, 4, 1, 0, 2, 1, 2, 1, 1, 1, 3, 2, 2, 1, 3, 1, 3, 2, 1, 6, 1, 1, 1, 3, 2
Offset: 1

Views

Author

Bradley Klee, Mar 01 2020

Keywords

Comments

Equivalently, a(n) is the number of triples [n,k,m] with k>0 satisfying the Diophantine equation n*(3*n-1) + k*(3*k-1) - m*(3*m-1) = 0. Any such triple satisfies a triangle inequality, n+k > m. The n for which there is a triple [n,n,m] are listed in A137694. Solutions of the form [n,m-1,m] appear only when n=3*z+1, z > 0. The n for which a(n)=0 are listed in A135768.

Examples

			Isosceles case, n=5: 2*5*(3*5-1) - 7*(3*7-1) = 0.
		

References

  • N. J. A. Sloane et al., "sum of 2 triangular numbers is a triangular number", math-fun mailing list, Feb. 19-29, 2020.

Crossrefs

Programs

  • Mathematica
    PentaTriples[PNn_] := Sort[Select[{PNn,
          (-PNn + 3 PNn^2 + # - 3 #^2)/(6 #),
          (-PNn + 3 PNn^2 + # + 3 #^2)/(6 #)
          } & /@ Divisors[PNn*(3*PNn - 1)],
       And[And @@ (IntegerQ /@ #), And @@ (# > 0 & /@ #)] &]]
    Length[PentaTriples[#]] & /@ Range[100]
    a[n_] := Length@FindInstance[n > 0 && y > 0 && z > 0 &&
         n (3 n - 1) + y (3 y - 1) == z (3 z - 1), {y, z}, Integers, 10^9];
    a /@ Range[100]
Showing 1-6 of 6 results.