login
This site is supported by donations to The OEIS Foundation.

 

Logo

Thanks to everyone who made a donation during our annual appeal!
To see the list of donors, or make a donation, see the OEIS Foundation home page.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A062831 Number of ways n can be expressed as the sum of a nonzero square and 1 or a prime. 0
0, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 2, 0, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 1, 0, 2, 3, 2, 1, 2, 0, 3, 2, 0, 2, 1, 1, 4, 2, 1, 2, 2, 1, 2, 2, 1, 3, 2, 1, 2, 2, 2, 2, 3, 1, 3, 2, 0, 2, 2, 0, 4, 2, 0, 3, 3, 2, 4, 2, 1, 2, 3, 1, 1, 3, 1, 4, 2, 1, 3, 1, 2, 5, 3, 0, 3, 3, 2, 2, 2, 0, 4, 2, 1, 3, 2, 1, 4, 1, 1, 3, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,6

LINKS

Table of n, a(n) for n=1..102.

FORMULA

Note that a(k^2)=0 or 1 since each prime can be written only in one way as a difference of squares: (n+b)^2-n^2=p where p is a prime, only if b^2+2nb=b(b+2n) is prime, only if b=1. In that case p=2n+1; since every prime is an odd number we get an 1 in the distribution of a(k^2) for each odd number which is prime.

MATHEMATICA

a[n_] := Length[Select[n-Range[1, Floor[Sqrt[n]]]^2, #==1||PrimeQ[ # ]&]]

CROSSREFS

Sequence in context: A002217 A157047 A059342 * A037828 A030419 A155052

Adjacent sequences:  A062828 A062829 A062830 * A062832 A062833 A062834

KEYWORD

nonn

AUTHOR

Santi Spadaro, Jul 20 2001

EXTENSIONS

Corrected and extended by Dean Hickerson, Jul 26, 2001

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified January 20 02:50 EST 2019. Contains 319322 sequences. (Running on oeis4.)