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.

A283183 Number of partitions of n into a prime and a square of an arbitrary integer.

Original entry on oeis.org

0, 1, 3, 2, 1, 4, 3, 2, 2, 0, 5, 4, 1, 4, 2, 2, 3, 4, 3, 4, 4, 2, 5, 2, 0, 2, 6, 4, 3, 4, 1, 6, 4, 0, 4, 2, 1, 8, 4, 2, 5, 4, 3, 4, 4, 2, 7, 4, 2, 2, 4, 4, 5, 6, 2, 6, 4, 0, 5, 4, 1, 8, 4, 0, 4, 6, 5, 8, 4, 2, 5, 6, 3, 2, 6, 2, 8, 4, 3, 6, 2, 2, 11, 6, 0, 6, 6
Offset: 1

Views

Author

Anton Mosunov, Mar 02 2017

Keywords

Comments

a(n) is also the number of solutions to the equation n = p + m^2, where p is prime and m is an arbitrary integer. In comparison, the sequence A002471 counts representations with m being nonnegative.
a(n) is odd if and only if n is prime.

Examples

			a(11) = 5 because 11 = 11 + 0^2 = 7 + (-2)^2 = 7 + 2^2 = 2 + (-3)^2 = 2 + 3^2.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Boole@ PrimeQ[n] + 2 Length@ Select[n - Range[Sqrt@ n]^2, PrimeQ]; Array[a, 87] (* Giovanni Resta, Apr 09 2017 *)
  • PARI
    local(i,j,k,total); for (i=1, 1000, j=1; k=1; total=isprime(i); while (j <= i, total += 2*isprime(i-j); j += (2*k+1); k++); print1(total, ", ")) \\ Anton Mosunov, Apr 09 2017