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.
%I A216504 #22 Mar 06 2025 01:53:20 %S A216504 0,2,2,0,3,3,3,5,0,4,4,5,6,4,4,0,7,6,6,7,6,6,5,8,0,6,7,8,9,6,7,10,8,8, %T A216504 6,0,11,7,7,11,12,7,9,11,11,8,7,11,0,9,8,13,12,10,8,12,12,10,9,11,15, %U A216504 8,11,0,12,9,11,15,12,10,9,17,18,10,11,16,12,9,12,15,0,12,10,14,14,11,10,17,18,13,11,15,15,12,10,17,21,12,14,0 %N A216504 Number of values of k for which n can be written in the form a^2 + k*b^2, a >= 0, b >= 0, k > 0. a(n) = 0 if there are infinitely many such k. %C A216504 A number can be written as a^2+b^2 if and only if it has no prime factor congruent to 3 (mod 4) raised to an odd power. %C A216504 A number can be written as a^2+2*b^2 if and only if it has no prime factor congruent to 5 (mod 8) or 7 (mod 8) raised to an odd power. %C A216504 A number can be written as a^2+3*b^2 if and only if it has no prime factor congruent to 2 (mod 3) raised to an odd power. %C A216504 A number can be written as a^2+7*b^2 if and only if it has no prime factor congruent to 3 (mod 7) or 5 (mod 7) or 6 (mod 7) raised to an odd power. Also the power of 2 should not be 1, if it can be written in the form a^2+7*b^2. %C A216504 a(n) = 0 if and only if n is a square. - _Charles R Greathouse IV_, Sep 11 2012 %H A216504 Robert Israel, <a href="/A216504/b216504.txt">Table of n, a(n) for n = 1..10000</a> %p A216504 N:= 100: # for a(1)..a(N) %p A216504 m:= floor(sqrt(N)): %p A216504 V:= Vector(N,i->{}): %p A216504 for a from 0 to m do %p A216504 for b from 1 to m do %p A216504 for k from 1 to floor((N-a^2)/b^2) do %p A216504 x:= a^2 + k*b^2; %p A216504 V[x]:= V[x] union {k}; %p A216504 od od od: %p A216504 for i from 1 to N do %p A216504 if issqr(i) then V[i]:=0 else V[i]:= nops(V[i]) fi %p A216504 od: %p A216504 convert(V,list); # _Robert Israel_, Mar 06 2025 %o A216504 (PARI) for(n=1, 100, sol=0; for(k=1, n, for(x=0, n, if(issquare(n-k*x*x)&&n-k*x*x>=0, sol++; break))); if(issquare(n), print1(0", "), print1(sol", "))) /* _V. Raman_, Oct 16 2012 */ %Y A216504 Cf. A001481, A154777, A092572. %K A216504 nonn,look %O A216504 1,2 %A A216504 _V. Raman_, Sep 07 2012