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.

A362961 a(n) = Sum_{b=0..floor(sqrt(n)), n-b^2 is square} b.

Original entry on oeis.org

1, 1, 0, 2, 3, 0, 0, 2, 3, 4, 0, 0, 5, 0, 0, 4, 5, 3, 0, 6, 0, 0, 0, 0, 12, 6, 0, 0, 7, 0, 0, 4, 0, 8, 0, 6, 7, 0, 0, 8, 9, 0, 0, 0, 9, 0, 0, 0, 7, 13, 0, 10, 9, 0, 0, 0, 0, 10, 0, 0, 11, 0, 0, 8, 20, 0, 0, 10, 0, 0, 0, 6, 11, 12, 0, 0, 0, 0, 0, 12, 9, 10, 0
Offset: 1

Views

Author

DarĂ­o Clavijo, May 10 2023

Keywords

Comments

a(n) = 0 if n in A022544.
a(n) > 0 if n in A001481.

Crossrefs

Cf. A143574 (sum of b^2), A000925.

Programs

  • Mathematica
    a[n_]:=Sum[b Boole[IntegerQ[Sqrt[n-b^2]]],{b,0,Floor[Sqrt[n]]}]; Array[a,83] (* Stefano Spezia, May 15 2023 *)
  • PARI
    a(n) = sum(b=0, sqrtint(n), if (issquare(n-b^2), b)); \\ Michel Marcus, May 16 2023
  • Python
    from gmpy2 import *
    a = lambda n: sum([b for b in range(0, isqrt(n) + 1) if is_square(n - (b*b))])
    print([a(n) for n in range(1, 84)])
    
  • Python
    from sympy import divisors
    from sympy.solvers.diophantine.diophantine import cornacchia
    def A362961(n):
        c = 0
        for d in divisors(n):
            if (k:=d**2)>n:
                break
            q, r = divmod(n,k)
            if not r:
                c += sum(d*(a[0]+(a[1] if a[0]!=a[1] else 0)) for a in cornacchia(1,1,q) or [])
        return c # Chai Wah Wu, May 15 2023