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.

Original entry on oeis.org

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, 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, 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
Offset: 0

Views

Author

R. J. Mathar, Apr 28 2020

Keywords

Comments

The range of the two triangular numbers and the square is the nonnegative numbers.

Examples

			a(0)=1 because there is one representation 0 = T(0)+T(0)+0^2.
a(1)=2 because there are 2 representations 1 = T(0)+T(0)+1^2 = T(0)+T(1)+0^2.
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.
		

Crossrefs

Cf. A115288 (greedy inverse).

Programs

  • Maple
    A330861 := 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;
                end if;
                if issqr(n-t1-t2) then
                    a := a+1 ;
                end if;
            end do:
        end do:
        a ;
    end proc: