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.

A063993 Number of ways of writing n as an unordered sum of exactly 3 nonzero triangular numbers.

This page as a plain text file.
%I A063993 #14 Jul 07 2022 14:43:24
%S A063993 0,0,0,1,0,1,0,1,1,1,1,0,2,1,1,1,1,2,1,2,0,2,2,2,1,1,2,2,2,0,3,2,2,2,
%T A063993 2,2,1,3,1,2,3,2,2,2,2,3,2,2,3,3,1,2,5,1,2,1,2,5,3,3,1,4,2,3,2,2,4,4,
%U A063993 2,1,4,3,3,3,2,4,3,3,3,4,2,1,6,1,5,3,3,5,2,2,2,5,2,5,4,2,4,5,3,1
%N A063993 Number of ways of writing n as an unordered sum of exactly 3 nonzero triangular numbers.
%C A063993 a(A002097(n)) = 0; a(A111638(n)) = 1; a(A064825(n)) = 2. - _Reinhard Zumkeller_, Jul 20 2012
%H A063993 T. D. Noe, <a href="/A063993/b063993.txt">Table of n, a(n) for n=0..5050</a>
%e A063993 5 = 3 + 1 + 1, so a(5) = 1.
%p A063993 A063993 := proc(n)
%p A063993     local a,t1idx,t2idx,t1,t2,t3;
%p A063993     a := 0 ;
%p A063993     for t1idx from 1 do
%p A063993         t1 := A000217(t1idx) ;
%p A063993         if 3*t1 > n then
%p A063993             break;
%p A063993         end if;
%p A063993         for t2idx from t1idx do
%p A063993             t2 := A000217(t2idx) ;
%p A063993             if t1+t2 > n then
%p A063993                 break;
%p A063993             end if;
%p A063993             t3 :=  n-t1-t2 ;
%p A063993             if t3 >= t2 then
%p A063993                 if isA000217(t3) then
%p A063993                     a := a+1 ;
%p A063993                 end if;
%p A063993             end if ;
%p A063993         end do:
%p A063993     end do:
%p A063993     a ;
%p A063993 end proc: # _R. J. Mathar_, Apr 28 2020
%t A063993 a = Table[ n(n + 1)/2, {n, 1, 15} ]; b = {0}; c = Table[ 0, {100} ]; Do[ b = Append[ b, a[ [ i ] ] + a[ [ j ] ] + a[ [ k ] ] ], {k, 1, 15}, {j, 1, k}, {i, 1, j} ]; b = Delete[ b, 1 ]; b = Sort[ b ]; l = Length[ b ]; Do[ If[ b[ [ n ] ] < 100, c[ [ b[ [ n ] ] + 1 ] ]++ ], {n, 1, l} ]; c
%o A063993 (Haskell)
%o A063993 a063993 n = length [() | let ts = takeWhile (< n) $ tail a000217_list,
%o A063993                     x <- ts, y <- takeWhile (<= x) ts,
%o A063993                     let z = n - x - y, 0 < z, z <= y, a010054 z == 1]
%o A063993 -- _Reinhard Zumkeller_, Jul 20 2012
%o A063993 (PARI) trmx(n)=my(k=sqrtint(8*n+1)\2);if(k^2+k>2*n,k-1,k)
%o A063993 trmn(n)=trmx(ceil(n)-1)+1
%o A063993 a(n)=if(n<3, return(0)); sum(a=trmn(n/3),trmx(n-2),my(t=n-a*(a+1)/2);sum(b=trmn(t/2),min(trmx(t-1),a), ispolygonal(t-b*(b+1)/2,3))) \\ _Charles R Greathouse IV_, Jul 07 2022
%Y A063993 Cf. A053604, A008443, A002636, A064181 (greedy inverse), A307598 (3 distinct positive).
%Y A063993 Cf. A000217, A010054.
%Y A063993 Column k=3 of A319797.
%K A063993 nonn,easy,nice
%O A063993 0,13
%A A063993 _N. J. A. Sloane_, Sep 18 2001
%E A063993 More terms from _Robert G. Wilson v_, Sep 20 2001