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.

A330861 Number of ways to represent n as a sum of 2 triangular numbers and a perfect square.

This page as a plain text file.
%I A330861 #14 Jan 08 2021 22:15:14
%S A330861 1,2,2,2,3,2,3,4,2,2,5,4,3,4,2,4,6,4,3,4,5,4,7,2,3,8,4,4,5,6,4,8,6,2,
%T A330861 5,4,6,8,7,4,8,4,5,8,2,6,10,8,3,6,6,6,10,4,4,10,8,6,7,6,7,8,6,2,9,10,
%U A330861 6,12,4,4,11,8,6,10,8,4,10,6,5,6,10,10,12,6,5,14,4,8,9,4,6,12
%N A330861 Number of ways to represent n as a sum of 2 triangular numbers and a perfect square.
%C A330861 The range of the two triangular numbers and the square is the nonnegative numbers.
%e A330861 a(0)=1 because there is one representation 0 = T(0)+T(0)+0^2.
%e A330861 a(1)=2 because there are 2 representations 1 = T(0)+T(0)+1^2 = T(0)+T(1)+0^2.
%e A330861 a(4)=3 because there are 3 representations 4 = T(0)+T(0)+2^2 = T(0)+T(2)+1^2 = T(1)+T(2)+0^2.
%p A330861 A330861 := proc(n)
%p A330861     local a,t1idx,t2idx,t1,t2;
%p A330861     a := 0 ;
%p A330861     for t1idx from 0 do
%p A330861         t1 := A000217(t1idx) ;
%p A330861         if t1 > n then
%p A330861             break;
%p A330861         end if;
%p A330861         for t2idx from t1idx do
%p A330861             t2 := A000217(t2idx) ;
%p A330861             if t1+t2 > n then
%p A330861                 break;
%p A330861             end if;
%p A330861             if issqr(n-t1-t2) then
%p A330861                 a := a+1 ;
%p A330861             end if;
%p A330861         end do:
%p A330861     end do:
%p A330861     a ;
%p A330861 end proc:
%Y A330861 Cf. A115288 (greedy inverse).
%K A330861 nonn
%O A330861 0,2
%A A330861 _R. J. Mathar_, Apr 28 2020