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.

A216503 a(n) = number of positive integers k such that n = x^2 + k*y^2 has a solution with x>0, y>0.

Original entry on oeis.org

0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 5, 3, 3, 4, 6, 5, 5, 5, 5, 5, 4, 6, 7, 5, 5, 6, 8, 5, 6, 7, 7, 7, 5, 9, 10, 6, 6, 9, 11, 6, 8, 9, 10, 7, 6, 10, 11, 7, 7, 11, 11, 8, 7, 10, 11, 9, 8, 9, 14, 7, 9, 10, 11, 8, 10, 13, 11, 9, 8, 15, 17, 9, 9, 14, 11, 8, 11, 12, 14
Offset: 1

Views

Author

V. Raman, Sep 07 2012

Keywords

Examples

			a(17) = 6 because
17 = 4^2 + 1*1^2.
17 = 3^2 + 2*2^2.
17 = 1^2 + 4*2^2.
17 = 3^2 + 8*1^2.
17 = 2^2 + 13*1^2.
17 = 1^2 + 16*1^2.
Therefore there are 6 different values of k for which 17 can be written in the form a^2 + k*b^2.
		

Crossrefs

Programs

  • Mathematica
    Table[cnt = 0; Do[b = 1; found = False; While[q = n - k*b^2; ! found && q > 0, If[IntegerQ[Sqrt[q]], cnt++; found = True]; b++], {k, n}]; cnt, {n, 100}] (* T. D. Noe, Sep 11 2012 *)
  • PARI
    for(n=1, 100, sol=0; for(k=1, n-1, for(x=1, n, if(issquare(n-k*x*x)&&n-k*x*x>0, sol++; break))); print1(sol", ")) /* V. Raman, Oct 16 2012 */