login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 59th year, we have over 358,000 sequences, and we’ve crossed 10,300 citations (which often say “discovered thanks to the OEIS”).

Other ways to Give
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A231015 Least k such that n = +- 1^2 +- 2^2 +- 3^2 +- 4^2 +- ... +- k^2 for some choice of +- signs. 6
7, 1, 4, 2, 3, 2, 3, 6, 7, 6, 4, 6, 3, 5, 3, 5, 7, 6, 7, 6, 4, 5, 4, 5, 7, 9, 7, 5, 4, 5, 4, 6, 7, 6, 7, 5, 7, 5, 7, 6, 7, 6, 7, 9, 8, 5, 8, 5, 7, 6, 7, 6, 11, 5, 8, 5, 7, 6, 7, 6, 7, 10, 7, 6, 7, 6, 7, 9, 7, 10, 7, 6, 7, 6, 8, 9, 8, 9, 8, 9, 7, 6, 7, 6, 11, 9 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,1

COMMENTS

Erdős and Surányi proved that for each n there are infinitely many k satisfying the equation.

A158092(k) is the number of solutions to 0 = +-1^2 +- 2^2 +- ... +- k^2. The first nonzero value is A158092(7) = 2, so a(0) = 7.

a(n) is also defined for n < 0, and clearly a(-n) = a(n).

See A158092 and the Andrica-Ionascu links for more comments.

The integral formula (3.6) in Andrica-Vacaretu (see Theorem 3 of the INTEGERS 2013 slides which has a typo) gives in this case the number of representations of n as +- 1^2 +- 2^2 +- ... +- k^2 for some choice of +- signs. This integral formula is (2^n/2*Pi)*Integral_{t=0..2*Pi} cos(n*t) * Product_{j=1..k} cos(j^2*t) dt. Clearly the number of such representations of n is the coefficient of z^n in the expansion (z^(1^2) + z^(-1^2))*(z^(2^2) + z^(-2^2))*...*(z^(k^2) + z^(-k^2)). Andrica-Vacaretu used this generating function to prove the integral formula. Section 4 of Andrica-Vacaretu gives a table of the number of such representations of n for k=1,...,9. - Dorin Andrica, Nov 12 2013

LINKS

Alois P. Heinz, Table of n, a(n) for n = 0..20000

D. Andrica and E. J. Ionascu, Variations on a result of Erdős and Surányi, Integers Conference 2013 Abstract.

D. Andrica and E. J. Ionascu, Variations on a result of Erdős and Surányi, INTEGERS 2013 slides.

D. Andrica and D. Vacaretu, Representation theorems and almost unimodal sequences, Studia Univ. Babes-Bolyai, Mathematica, Vol. LI, 4 (2006), 23-33.

P. Erdős and J. Surányi, Egy additív számelméleti probléma (in Hungarian; Russian and German summaries), Mat. Lapok 10 (1959), pp. 284-290.

FORMULA

a(n(n+1)(2n+1)/6) = a(A000330(n)) = n for n > 0.

a((n(n+1)(2n+1)/6)-2) = a(A000330(n)-2) = n for n > 0.

EXAMPLE

0 = 1^2 + 2^2 - 3^2 + 4^2 - 5^2 - 6^2 + 7^2.

1 = 1^2.

2 = - 1^2 - 2^2 - 3^2 + 4^2.

3 = - 1^2 + 2^2.

4 = - 1^2 - 2^2 + 3^2.

MAPLE

b:= proc(n, i) option remember; local m; m:=i*(i+1)*(2*i+1)/6;

n<=m and (n=m or b(n+i^2, i-1) or b(abs(n-i^2), i-1))

end:

a:= proc(n) local k; for k while not b(n, k) do od; k end:

seq(a(n), n=0..100); # Alois P. Heinz, Nov 03 2013

MATHEMATICA

b[n_, i_] := b[n, i] = Module[{m}, m = i*(i+1)*(2*i+1)/6; n <= m && (n == m || b[n+i^2, i-1] || b[Abs[n-i^2], i-1])]; a[n_] := Module[{k}, For[k = 1, !b[n, k] , k++]; k]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Jan 28 2014, after Alois P. Heinz *)

CROSSREFS

Cf. A000330, A158092, A231071, A231272.

Sequence in context: A010504 A242132 A011450 * A183031 A021018 A010145

Adjacent sequences: A231012 A231013 A231014 * A231016 A231017 A231018

KEYWORD

nonn,look

AUTHOR

Jonathan Sondow, Nov 02 2013

EXTENSIONS

a(4) corrected and a(5)-a(85) from Donovan Johnson, Nov 03 2013

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 30 17:37 EST 2022. Contains 358453 sequences. (Running on oeis4.)