login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A216282 Number of nonnegative solutions to the equation x^2 + 2*y^2 = n. 5
1, 1, 1, 1, 0, 1, 0, 1, 2, 0, 1, 1, 0, 0, 0, 1, 1, 2, 1, 0, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 1, 2, 1, 0, 2, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 2, 0, 0, 2, 0, 0, 2, 0, 1, 0, 0, 0, 0, 1, 0, 2, 1, 1, 0, 0, 0, 2, 1, 0, 1, 1, 0, 0, 0, 0, 3, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 3, 1, 0, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0, 1, 0, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,9

COMMENTS

Records occur at 1, 9, 81, 297, 891, 1683, 5049, 15147, 31977, ... - Antti Karttunen, Aug 23 2017

LINKS

Antti Karttunen, Table of n, a(n) for n = 1..65537

EXAMPLE

For n = 9, there are two solutions: 9 = 9^2 + 2*(0^2) = 1^2 + 2*(2^2), thus a(9) = 2.

For n = 81, there are three solutions: 81 = 9^2 + 2*(0^2) = 3^2 + 2*(6^2) = 7^2 + 2*(4^2), thus a(81) = 3.

For n = 65536, there is one solution: 65536 = 256^2 + 2*(0^2) = 65536 + 0, thus a(65536) = 1.

For n = 65537, there is one solution: 65537 = 255^2 + 2*(16^2) = 65205 + 512, thus a(65537) = 1.

MATHEMATICA

r[n_] := Reduce[x >= 0 && y >= 0 && x^2 + 2 y^2 == n, Integers];

a[n_] := Which[rn = r[n]; rn === False, 0, Head[rn] === And, 1, Head[rn] === Or, Length[rn], True, -1];

Table[a[n], {n, 1, 120}] (* Jean-Fran├žois Alcover, Jun 24 2017 *)

PROG

(Scheme) (define (A216282 n) (cond ((< n 2) 1) (else (let loop ((k (- (A000196 n) (modulo (- n (A000196 n)) 2))) (s 0)) (if (< k 0) s (let ((x (/ (- n (* k k)) 2))) (loop (- k 2) (+ s (A010052 x))))))))) ;; Antti Karttunen, Aug 23 2017

CROSSREFS

Cf. A092573, A119395, A000161, A025426, A216283.

Cf. A002479 (positions of nonzeros), A097700 (of zeros).

Sequence in context: A124735 A064874 A286563 * A147861 A167271 A156348

Adjacent sequences:  A216279 A216280 A216281 * A216283 A216284 A216285

KEYWORD

nonn

AUTHOR

V. Raman, Sep 03 2012

EXTENSIONS

Examples from Antti Karttunen, Aug 23 2017

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 October 22 22:35 EDT 2021. Contains 348180 sequences. (Running on oeis4.)