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.

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

This page as a plain text file.
%I A363051 #16 Jan 31 2024 07:41:43
%S A363051 0,1,0,0,1,0,0,2,0,1,0,0,2,0,0,0,1,3,0,2,0,0,0,0,3,1,0,0,2,0,0,4,0,3,
%T A363051 0,0,1,0,0,2,4,0,0,0,3,0,0,0,0,6,0,4,2,0,0,0,0,3,0,0,5,0,0,0,5,0,0,2,
%U A363051 0,0,0,6,3,5,0,0,0,0,0,4,0,1,0
%N A363051 a(n) = Sum_{b=0..floor(sqrt(n/2)), n-b^2 is square} b.
%C A363051 a(n) = 0 if n in A022544.
%C A363051 a(n) > 0 if n in A001481.
%H A363051 Project Euler, <a href="https://projecteuler.net/problem=273">Problem 273: Sum of Squares</a>
%p A363051 A363051 := proc(n)
%p A363051     local x,a ;
%p A363051     a := 0 ;
%p A363051     for x from 1 do
%p A363051         if x^2 > n/2 then
%p A363051             return a;
%p A363051         end if;
%p A363051         if issqr(n-x^2) then
%p A363051             a := a+x ;
%p A363051         end if;
%p A363051     end do:
%p A363051 end proc:
%p A363051 seq(A363051(n),n=1..100) ; # _R. J. Mathar_, Jan 31 2024
%t A363051 a[n_]:=Sum[b Boole[IntegerQ[Sqrt[n-b^2]]],{b,0,Floor[Sqrt[n/2]]}]; Array[a,83] (* _Stefano Spezia_, May 15 2023 *)
%o A363051 (Python)
%o A363051 from gmpy2 import *
%o A363051 a = lambda n: sum([b for b in range(0, isqrt(n >> 1) + 1) if is_square(n - (b*b))])
%o A363051 print([a(n) for n in range(1, 84)])
%o A363051 (Python)
%o A363051 from sympy.solvers.diophantine.diophantine import diop_DN
%o A363051 def A363051(n): return sum(min(a) for a in diop_DN(-1,n))>>1 # _Chai Wah Wu_, May 16 2023
%Y A363051 Cf. A022544, A001481, A362961.
%K A363051 nonn
%O A363051 1,8
%A A363051 _DarĂ­o Clavijo_, May 14 2023