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.

A219610 Number of ways n can be written as sum of squares < n.

Original entry on oeis.org

1, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 9, 10, 10, 12, 13, 14, 14, 16, 18, 20, 21, 23, 26, 27, 28, 31, 34, 37, 38, 42, 46, 49, 50, 55, 60, 63, 66, 71, 78, 81, 84, 90, 97, 104, 107, 116, 124, 132, 135, 144, 154, 163, 169, 178, 192, 201, 209, 219, 235, 247, 256, 271, 286, 302, 311, 329, 347, 365, 378, 397, 420, 438, 455, 476, 503
Offset: 0

Views

Author

M. F. Hasler, Apr 12 2013

Keywords

Comments

Inspired by A034295, but not involving the same geometrical idea & restrictions.

Examples

			a(16)=7 since 16 = 3^2+7*1 = 3^2+2^2+3*1 = 2^2+12*1 = 2*2^2+8*1 = 3*2^2+4*1 = 4*2^2 = 16*1^2 (where 1 = 1^2).
a(17)=9 since 17 = 4^2+1 = 3^2+8*1 = 3^2+2^2+4*1 = 3^2+2*2^2 = 2^2+13*1 = 2*2^2+9*1 = 3*2^2+5*1 = 4*2^2+1 = 17*1^2.
		

Crossrefs

Cf. A034295.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 1,
          `if`(i<1, 0, b(n, i-1) +`if`(i^2>n, 0, b(n-i^2, i))))
        end:
    a:= proc(n) local r; r:= isqrt(n);
           b(n, r-`if`(r^2>=n, 1, 0))
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Apr 16 2013
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0, 1,
         If[i < 1, 0, b[n, i - 1] + If[i^2 > n, 0, b[n - i^2, i]]]];
    a[n_] := With[{r = Floor@Sqrt[n]}, b[n, r - If[r^2 >= n, 1, 0]]];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Apr 28 2022, after Alois P. Heinz *)
  • PARI
    a(n,m)={!m && n<5 && return(n!=1); m || m=sqrtint(n-1); sum(k=2,m, sum(j=1,n\k^2,a(n-j*k^2,k-1)),1)}

Formula

a(n^2+1) >= A034295(n).