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

A052343 Number of ways to write n as the unordered sum of two triangular numbers (zero allowed).

Original entry on oeis.org

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

Views

Author

Christian G. Bower, Jan 23 2000

Keywords

Comments

Number of ways of writing n as a sum of a square and twice a triangular number (zeros allowed). - Michael Somos, Aug 18 2003
a(A020757(n))=0; a(A020756(n))>0; a(A119345(n))=1; a(A118139(n))>1. - Reinhard Zumkeller, May 15 2006
Also, number of ways to write 4n+1 as the unordered sum of two squares of nonnegative integers. - Vladimir Shevelev, Jan 21 2009
The average value of a(n) for n <= x is Pi/4 + O(1/sqrt(x)). - Vladimir Shevelev, Feb 06 2009

Examples

			G.f. = 1 + x + x^2 + x^3 + x^4 + 2*x^6 + x^7 + x^9 + x^10 + x^11 + ...
		

Crossrefs

Programs

  • Haskell
    a052343 = (flip div 2) . (+ 1) . a008441
    -- Reinhard Zumkeller, Jul 25 2014
  • Maple
    A052343 := proc(n)
        local a,t1idx,t2idx,t1,t2;
        a := 0 ;
        for t1idx from 0 do
            t1 := A000217(t1idx) ;
            if t1 > n then
                break;
            end if;
            for t2idx from t1idx do
                t2 := A000217(t2idx) ;
                if t1+t2 > n then
                    break;
                elif t1+t2 = n then
                    a := a+1 ;
                end if;
            end do:
        end do:
        a ;
    end proc: # R. J. Mathar, Apr 28 2020
  • Mathematica
    Length[PowersRepresentations[4 # + 1, 2, 2]] & /@ Range[0, 101] (* Ant King, Dec 01 2010 *)
    d1[k_]:=Length[Select[Divisors[k],Mod[#,4]==1&]];d3[k_]:=Length[Select[Divisors[k],Mod[#,4]==3&]];f[k_]:=d1[k]-d3[k];g[k_]:=If[IntegerQ[Sqrt[4k+1]],1/2 (f[4k+1]+1),1/2 f[4k+1]];g[#]&/@Range[0,101] (* Ant King, Dec 01 2010 *)
    a[ n_] := Length @ Select[ Table[ Sqrt[n - i - i^2], {i, 0, Quotient[ Sqrt[4 n + 1] - 1, 2]}], IntegerQ]; (* Michael Somos, Jul 28 2015 *)
    a[ n_] := Length @ FindInstance[ {j >= 0, k >= 0, j^2 + k^2 + k == n}, {k, j}, Integers, 10^9]; (* Michael Somos, Jul 28 2015 *)
  • PARI
    {a(n) = if( n<0, 0, sum(i=0, (sqrtint(4*n + 1) - 1)\2, issquare(n - i - i^2)))}; /* Michael Somos, Aug 18 2003 */
    

Formula

a(n) = ceiling(A008441(n)/2). - Reinhard Zumkeller, Nov 03 2009
G.f.: (Sum_{k>=0} x^(k^2 + k)) * (Sum_{k>=0} x^(k^2)). - Michael Somos, Aug 18 2003
Recurrence: a(n) = Sum_{k=1..r(n)} r(2n-k^2+k) - C(r(n),2) - a(n-1) - a(n-2) - ... - a(0), n>=1,a (0)=1, where r(n)=A000194(n+1) is the nearest integer to square root of n+1. For example, since r(6)=3, a(6) = r(12) + r(10) + r(6) - C(3,2) - a(5) - ... - a(0) = 4 + 3 + 3 - 3 - 0 - 1 - 1 - 1 - 1 - 1 = 2. - Vladimir Shevelev, Feb 06 2009
a(n) = A025426(8n+2). - Max Alekseyev, Mar 09 2009
a(n) = (A002654(4n+1) + A010052(4n+1)) / 2. - Ant King, Dec 01 2010
a(2*n + 1) = A053692(n). a(4*n + 1) = A259287(n). a(4*n + 3) = A259285(n). a(6*n + 1) = A260415(n). a(6*n + 4) = A260516(n). - Michael Somos, Jul 28 2015
a(3*n) = A093518(n). a(3*n + 1) = A121444(n). a(9*n + 2) = a(n). a(9*n + 5) = a(9*n + 8) = 0. - Michael Somos, Jul 28 2015
Convolution of A005369 and A010052. - Michael Somos, Jul 28 2015

A020756 Numbers that are the sum of two triangular numbers.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 7, 9, 10, 11, 12, 13, 15, 16, 18, 20, 21, 22, 24, 25, 27, 28, 29, 30, 31, 34, 36, 37, 38, 39, 42, 43, 45, 46, 48, 49, 51, 55, 56, 57, 58, 60, 61, 64, 65, 66, 67, 69, 70, 72, 73, 76, 78, 79, 81, 83, 84, 87, 88, 90, 91, 92, 93, 94, 97, 99, 100, 101, 102, 105, 106, 108
Offset: 1

Views

Author

Keywords

Comments

The possible sums of a square and a promic, i.e., x^2+n(n+1), e.g., 3^2 + 2*3 = 9 + 6 = 15 is present. - Jon Perry, May 28 2003
A052343(a(n)) > 0; union of A118139 and A119345. - Reinhard Zumkeller, May 15 2006
Also union of A051533 and A000217. - Ant King, Nov 29 2010

Crossrefs

Complement of A020757.
Cf. A051533 (sums of two positive triangular numbers), A001481 (sums of two squares), A002378, A000217.
Cf. A052343.

Programs

  • Haskell
    a020756 n = a020756_list !! (n-1)
    a020756_list = filter ((> 0) . a052343) [0..]
    -- Reinhard Zumkeller, Jul 25 2014
  • Mathematica
    q[k_] := If[! Head[Reduce[m (m + 1) + n (n + 1) == 2 k && 0 <= m && 0 <= n, {m, n}, Integers]] === Symbol, k, {}]; DeleteCases[Table[q[i], {i, 0, 108}], {}] (* Ant King, Nov 29 2010 *)
    Take[Union[Total/@Tuples[Accumulate[Range[0,20]],2]],80] (* Harvey P. Dale, May 02 2012 *)
  • PARI
    v=vector(200); vc=0; for (x=0,10, for (y=0,10,v[vc++ ]=x^2+y*(y+1))); v=vecsort(v); v
    
  • PARI
    is(n)=my(f=factor(4*n+1));for(i=1,#f~,if(f[i,1]%4==3 && f[i,2]%2, return(0))); 1 \\ Charles R Greathouse IV, Jul 05 2013
    

Formula

Numbers n such that 4n+1 is the sum of two squares, i.e. such that 4n+1 is in A001481. Hence n is a member if and only if 4n+1 = odd square * product of distinct primes of form 4k+1. (Fred Helenius and others, Dec 18 2004)
Equivalently, we may say that a positive integer n can be partitioned into a sum of two triangular numbers if and only if every 4 k + 3 prime factor in the canonical form of 4 n + 1 occurs with an even exponent. - Ant King, Nov 29 2010
Also, the values of n for which 8n+2 can be partitioned into a sum of two squares of natural numbers. - Ant King, Nov 29 2010
Closed under the operation f(x, y) = 4*x*y + x + y.

Extensions

Entry revised by N. J. A. Sloane, Dec 20 2004

A119345 Numbers having exactly one representation as sum of two triangular numbers.

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 9, 10, 11, 12, 13, 15, 18, 20, 22, 24, 25, 27, 28, 29, 30, 34, 37, 38, 39, 43, 45, 48, 49, 57, 58, 60, 61, 64, 65, 67, 69, 70, 73, 78, 79, 83, 84, 87, 88, 90, 92, 93, 97, 99, 100, 101, 102, 105, 108, 110, 112, 114, 115, 119, 127, 130, 132, 135, 137, 139, 142
Offset: 1

Views

Author

Reinhard Zumkeller, May 15 2006

Keywords

Comments

A052343(a(n)) = 1; gives A020756 together with A118139.

Crossrefs

Programs

  • Haskell
    a119345 n = a119345_list !! (n-1)
    a119345_list = filter ((== 1) . a052343) [0..]
    -- Reinhard Zumkeller, Jul 25 2014
  • Mathematica
    trn=SortBy[{First[#],Last[#],Total[#]}& /@ (Union[Sort/@Tuples[Accumulate[Range[0,70]],{2}]]),Last]; Take[With[{x=Transpose[trn][[3]]}, Complement[Union[x], Union[Flatten[Select[Split[x], Length[#]>1&]]]]],70]  (* Harvey P. Dale, Feb 14 2011 *)
    nn=100; tri=Table[n(n+1)/2,{n,0,nn}]; sums=Select[Flatten[Table[tri[[i]]+tri[[j]], {i,nn}, {j,i}]], #
    				

A342219 a(1) = 1, a(2) = 2; for n > 2, a(n) = the number of terms in the maximal length sum of previous consecutive terms that equals n.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Mar 05 2021

Keywords

Comments

The equivalent sequence for a minimal length sum is given by A003059.

Examples

			a(3) = 2 as the only way to sum previous consecutive terms to make 3 is 1 + 2 = 3, which contains two terms.
a(7) = 4 as the previous consecutive terms 1 + 2 + 2 + 2 = 7, which contains four terms. Note that 7 can also be made by consecutive terms 2 + 2 + 3 = 7, but the sequence is the maximal sum length.
a(10) = 5 as the previous consecutive terms 1 + 2 + 2 + 2 + 3 = 10, which contains five terms. Three other consecutive term sums also exist that sum to 10 but they contain fewer terms.
		

Crossrefs

Showing 1-4 of 4 results.