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.

Original entry on oeis.org

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, 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, 7, 9, 9, 9, 8, 7, 7, 9, 9, 9, 9, 9, 7, 8, 8, 10, 10, 6
Offset: 0

Views

Author

Reinhard Zumkeller, Sep 14 2014

Keywords

Examples

			a(10) = #{0+10, 4+6} = 2;
a(11) = #{0+11, 1+10, 4+7, 9+2} = 4;
a(12) = #{0+12, 1+11, 4+8, 9+3} = 4;
a(13) = #{0+13, 1+12} = 2;
a(14) = #{0+14, 1+13, 4+10, 9+5} = 4;
a(15) = #{0+15, 1+14, 4+11, 9+6} = 4;
a(16) = #{1+15, 4+12, 9+7} = 3;
a(17) = #{0+17, 4+13, 9+8} = 3;
a(18) = #{0+18, 1+17, 4+14, 16+2} = 4;
a(19) = #{0+19, 1+18, 4+15, 9+10, 16+3} = 5;
a(20) = #{0+20, 1+19, 9+11} = 3.
		

Crossrefs

Programs

  • Haskell
    a247367 n = sum $ map ((1 -) . a010052 . (n -)) $
                      takeWhile (<= n) a000290_list
  • Mathematica
    sQ[n_] := sQ[n] = IntegerQ[Sqrt[n]];
    a[n_] := Sum[Boole[sQ[k] && !sQ[n-k] || !sQ[k] && sQ[n-k]], {k, 0, Quotient[n, 2]}];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Aug 10 2022 *)