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.

This page as a plain text file.
%I A362961 #35 May 16 2023 12:53:27
%S A362961 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,
%T A362961 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,
%U A362961 0,10,0,0,0,6,11,12,0,0,0,0,0,12,9,10,0
%N A362961 a(n) = Sum_{b=0..floor(sqrt(n)), n-b^2 is square} b.
%C A362961 a(n) = 0 if n in A022544.
%C A362961 a(n) > 0 if n in A001481.
%H A362961 Stefano Spezia, <a href="/A362961/b362961.txt">Table of n, a(n) for n = 1..10000</a>
%t A362961 a[n_]:=Sum[b Boole[IntegerQ[Sqrt[n-b^2]]],{b,0,Floor[Sqrt[n]]}]; Array[a,83] (* _Stefano Spezia_, May 15 2023 *)
%o A362961 (Python)
%o A362961 from gmpy2 import *
%o A362961 a = lambda n: sum([b for b in range(0, isqrt(n) + 1) if is_square(n - (b*b))])
%o A362961 print([a(n) for n in range(1, 84)])
%o A362961 (Python)
%o A362961 from sympy import divisors
%o A362961 from sympy.solvers.diophantine.diophantine import cornacchia
%o A362961 def A362961(n):
%o A362961     c = 0
%o A362961     for d in divisors(n):
%o A362961         if (k:=d**2)>n:
%o A362961             break
%o A362961         q, r = divmod(n,k)
%o A362961         if not r:
%o A362961             c += sum(d*(a[0]+(a[1] if a[0]!=a[1] else 0)) for a in cornacchia(1,1,q) or [])
%o A362961     return c # _Chai Wah Wu_, May 15 2023
%o A362961 (PARI) a(n) = sum(b=0, sqrtint(n), if (issquare(n-b^2), b)); \\ _Michel Marcus_, May 16 2023
%Y A362961 Cf. A022544, A001481.
%Y A362961 Cf. A143574 (sum of b^2), A000925.
%K A362961 nonn,look
%O A362961 1,4
%A A362961 _DarĂ­o Clavijo_, May 10 2023