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.

A215537 Lowest k such that k is representable as both the sum of n and of n+1 nonzero squares.

Original entry on oeis.org

25, 17, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79
Offset: 1

Views

Author

Jon Perry, Aug 15 2012

Keywords

Examples

			25 = 5^2 = 3^2 + 4^2
17 = 4^2 + 1^2 = 3^2 + 2^2 + 2^2
12 = 2^2 + 2^2 + 2^2 = 3^2 + 1^2 + 1^2 + 1^2
after this just add 1^2 to both sides.
		

Crossrefs

Cf. A000290 (representable as sum of 1 square), A000404 (sum of 2 positive squares), A000408 (sum of 3 positive squares), A000414 (sum of 4 positive squares), A047700 (sum of 5 positive squares)

Programs

  • Maple
    # true if a is representable as a sum of n squares, each square >= m^2.
    isRepnSqrsMin := proc(a,n,m)
        local mpr ;
        if a < n*m^2 then
            return false;
        end if;
        if n = 1 then
            if a>= m^2 and issqr(a) then
                true;
            else
                false;
            end if;
        else
            for mpr from m to a do
                if a-mpr^2 < 1 then
                    return false;
                elif procname(a-mpr^2,n-1,mpr) then
                    return true;
                end if;
            end do:
        end if;
    end proc:
    # true if a is representable as a sum of n positive squares.
    isRepnSqrs := proc(a,n)
        isRepnSqrsMin(a,n,1) ;
    end proc:
    A215537 := proc(n)
        local k;
        for k from 1 do
            if isRepnSqrs(k,n) and isRepnSqrs(k,n+1) then
                return k;
            end if;
        end do:
    end proc: # R. J. Mathar, Sep 11 2012