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.

A143574 Sum of all distinct squares occurring when partitioning n into two squares.

Original entry on oeis.org

0, 1, 1, 0, 4, 5, 0, 0, 4, 9, 10, 0, 0, 13, 0, 0, 16, 17, 9, 0, 20, 0, 0, 0, 0, 50, 26, 0, 0, 29, 0, 0, 16, 0, 34, 0, 36, 37, 0, 0, 40, 41, 0, 0, 0, 45, 0, 0, 0, 49, 75, 0, 52, 53, 0, 0, 0, 0, 58, 0, 0, 61, 0, 0, 64, 130, 0, 0, 68, 0, 0, 0, 36, 73, 74, 0, 0, 0, 0, 0, 80, 81, 82, 0, 0, 170, 0, 0, 0
Offset: 0

Views

Author

Reinhard Zumkeller, Aug 24 2008

Keywords

Comments

For n > 0: a(n) = 0 iff A000161(n) = 0: a(A022544(n)) = 0;
A143575 gives numbers m such that a(m) = m.

Examples

			A000161(25)=#{5^2+0^2,4^2+3^2}=2: a(25)=25+0+16+9=50;
A000161(26)=#{5^2+1^2}=1: a(16)=25+1=26;
A000161(49)=#{7^2+0^2}=1: a(49)=49+0=49;
A000161(50)=#{7^2+1^2,5^2+5^2}=2: a(50)=49+1+25=75;
A000161(2600)=#{50^2+10^2,46^2+22^2,38^2+34^2}=3: a(2600)=2500+100+2116+484+1444+1156=7800;
A000161(2601)=#{51^2+0^2,45^2+24^2}=2: a(2601)=2601+0+12025+576=5202;
A000161(2602)=#{51^2+1^2}=1: a(2602)=2601+1=2602.
		

Crossrefs

Programs

  • PARI
    a(n) = sum(k=1, n, if (issquare(k) && issquare(n-k), k)); \\ Michel Marcus, May 16 2023
  • Python
    from sympy import divisors
    from sympy.solvers.diophantine.diophantine import cornacchia
    def A143574(n):
        c = 0
        for d in divisors(n):
            if (k:=d**2)>n:
                break
            q, r = divmod(n,k)
            if not r:
                c += sum(k*(a[0]**2+(a[1]**2 if a[0]!=a[1] else 0)) for a in cornacchia(1,1,q) or [])
        return c # Chai Wah Wu, May 15 2023
    

Formula

a(n) = Sum_{k=1..n} k*A010052(k)*A010052(n-k). [Reinhard Zumkeller, Sep 27 2008]