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.

A247367 Number of ways to write n as a sum of a square and a nonsquare.

This page as a plain text file.
%I A247367 #8 Aug 10 2022 03:06:49
%S A247367 0,0,1,2,1,1,3,3,2,2,2,4,4,2,4,4,3,3,4,5,3,5,5,5,5,2,4,6,6,4,6,6,5,6,
%T A247367 4,6,5,5,7,7,5,5,7,7,7,5,7,7,7,6,5,8,6,6,8,8,8,8,6,8,8,6,8,8,7,5,9,9,
%U A247367 7,9,9,9,8,7,7,9,9,9,9,9,7,8,8,10,10,6
%N A247367 Number of ways to write n as a sum of a square and a nonsquare.
%H A247367 Reinhard Zumkeller, <a href="/A247367/b247367.txt">Table of n, a(n) for n = 0..10000</a>
%e A247367 a(10) = #{0+10, 4+6} = 2;
%e A247367 a(11) = #{0+11, 1+10, 4+7, 9+2} = 4;
%e A247367 a(12) = #{0+12, 1+11, 4+8, 9+3} = 4;
%e A247367 a(13) = #{0+13, 1+12} = 2;
%e A247367 a(14) = #{0+14, 1+13, 4+10, 9+5} = 4;
%e A247367 a(15) = #{0+15, 1+14, 4+11, 9+6} = 4;
%e A247367 a(16) = #{1+15, 4+12, 9+7} = 3;
%e A247367 a(17) = #{0+17, 4+13, 9+8} = 3;
%e A247367 a(18) = #{0+18, 1+17, 4+14, 16+2} = 4;
%e A247367 a(19) = #{0+19, 1+18, 4+15, 9+10, 16+3} = 5;
%e A247367 a(20) = #{0+20, 1+19, 9+11} = 3.
%t A247367 sQ[n_] := sQ[n] = IntegerQ[Sqrt[n]];
%t A247367 a[n_] := Sum[Boole[sQ[k] && !sQ[n-k] || !sQ[k] && sQ[n-k]], {k, 0, Quotient[n, 2]}];
%t A247367 Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, Aug 10 2022 *)
%o A247367 (Haskell)
%o A247367 a247367 n = sum $ map ((1 -) . a010052 . (n -)) $
%o A247367                   takeWhile (<= n) a000290_list
%Y A247367 Cf. A000037, A000290, A010052, A000925, A000161.
%K A247367 nonn
%O A247367 0,4
%A A247367 _Reinhard Zumkeller_, Sep 14 2014