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-5 of 5 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

A118139 Numbers expressible as the sum of two triangular numbers in at least two different ways.

Original entry on oeis.org

6, 16, 21, 31, 36, 42, 46, 51, 55, 56, 66, 72, 76, 81, 91, 94, 106, 111, 120, 121, 123, 126, 133, 136, 141, 146, 156, 157, 171, 172, 174, 181, 186, 191, 196, 198, 210, 211, 216, 225, 226, 231, 237, 241, 246, 256, 259, 268, 276, 281, 286, 289, 291, 297, 301, 306
Offset: 1

Views

Author

Greg Huber, May 13 2006

Keywords

Comments

A052343(a(n)) > 1; gives A020756 together with A119345. - Reinhard Zumkeller, May 15 2006

Examples

			a(1) = 6 = 0 + 6 = 3 +3.
a(2) = 16 = 1 + 15 = 6 + 10.
a(3) = 21 = 0 + 21 = 6 + 15.
		

Crossrefs

Programs

  • Haskell
    a118139 n = a118139_list !! (n-1)
    a118139_list = filter ((> 1) . a052343) [0..]
    -- Reinhard Zumkeller, Jul 25 2014
  • Mathematica
    Sort[Transpose[Select[Tally[Total/@(Union[Sort/@Tuples[Accumulate[ Range[ 0,30]],2]])],#[[2]]>1&]][[1]]] (* Harvey P. Dale, Jul 21 2015 *)

Extensions

More terms from Reinhard Zumkeller, May 15 2006

A125018 Numbers == 1 (mod 4) with a unique partition as a sum of 2 squares x^2 + y^2.

Original entry on oeis.org

1, 5, 9, 13, 17, 29, 37, 41, 45, 49, 53, 61, 73, 81, 89, 97, 101, 109, 113, 117, 121, 137, 149, 153, 157, 173, 181, 193, 197, 229, 233, 241, 245, 257, 261, 269, 277, 281, 293, 313, 317, 333, 337, 349, 353, 361, 369, 373, 389, 397, 401, 405, 409, 421, 433
Offset: 1

Views

Author

Artur Jasinski, Nov 16 2006

Keywords

Examples

			5 = 1^2 + 2^2, 9 = 0^2 + 3^2, 13 = 2^2 + 3^2, 17 = 1^2 + 4^2, 29 = 2^2 + 5^2, ... - _Michael Somos_, Jul 25 2023
		

Crossrefs

Programs

  • Mathematica
    Select[4 * Range[0, 100] + 1, Length @ PowersRepresentations[#, 2, 2] == 1 &] (* Amiram Eldar, Mar 12 2020 *)
  • PARI
    isok(n)= {if (n % 4 != 1, return(0)); A000161(n) == 1;} \\ Michel Marcus, Nov 02 2013

Extensions

More terms from Michel Marcus, Nov 02 2013

A274794 Numbers n such that n^3 is the sum of two triangular numbers in exactly one way.

Original entry on oeis.org

0, 1, 3, 4, 7, 9, 10, 19, 24, 25, 34, 37, 39, 42, 49, 54, 55, 72, 73, 78, 85, 87, 93, 94, 102, 108, 109, 118, 138, 142, 147, 157, 160, 165, 168, 175, 192, 195, 202, 210, 214, 220, 228, 232, 243, 247, 249, 250, 252, 253, 258, 267, 273, 274, 279, 289, 297, 312, 333
Offset: 1

Views

Author

Altug Alkan, Jul 07 2016

Keywords

Comments

A115104 is a subsequence. Terms such that 4*n^3 + 1 is not prime are 24, 337, 457, 750, 840, 1015, ...

Examples

			3 is a term because 3^3 = 27 = 6 + 21.
		

Crossrefs

Programs

  • Mathematica
    Select[Range@ 333, Length[PowersRepresentations[4 #^3 + 1, 2, 2]] == 1 &] (* after Ant King at A052343, or *)
    nn = 20; t = (#^2 + #)/2 & /@ Range[0, nn^3]; Select[Range[0, nn], Function[n, Count[Transpose@ {#, n^3 - #} &@ Range[0, Floor[n^3/2]], k_ /; Times @@ Boole@ Map[MemberQ[t, #] &, k] == 1] == 1]] (* Michael De Vlieger, Jul 07 2016 *)
  • PARI
    a052343(n) = sum(i=0, (sqrtint(4*n + 1) - 1)\2, issquare(n - i - i^2));
    lista(nn) = for(n=0, nn, if(a052343(n^3) == 1, print1(n, ", ")));
Showing 1-5 of 5 results.