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.

A231015 Least k such that n = +- 1^2 +- 2^2 +- 3^2 +- 4^2 +- ... +- k^2 for some choice of +- signs.

This page as a plain text file.
%I A231015 #58 Feb 28 2022 02:05:53
%S A231015 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,
%T A231015 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,
%U A231015 9,7,10,7,6,7,6,8,9,8,9,8,9,7,6,7,6,11,9
%N A231015 Least k such that n = +- 1^2 +- 2^2 +- 3^2 +- 4^2 +- ... +- k^2 for some choice of +- signs.
%C A231015 Erdős and Surányi proved that for each n there are infinitely many k satisfying the equation.
%C A231015 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.
%C A231015 a(n) is also defined for n < 0, and clearly a(-n) = a(n).
%C A231015 See A158092 and the Andrica-Ionascu links for more comments.
%C A231015 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
%H A231015 Alois P. Heinz, <a href="/A231015/b231015.txt">Table of n, a(n) for n = 0..20000</a>
%H A231015 D. Andrica and E. J. Ionascu, <a href="http://www.westga.edu/~math/IntegersConference2013/aaAbstracts.pdf?usp=sharing">Variations on a result of Erdős and Surányi</a>, Integers Conference 2013 Abstract.
%H A231015 D. Andrica and E. J. Ionascu, <a href="http://www.dorinandrica.ro/files/presentation-INTEGERS-2013.pdf">Variations on a result of Erdős and Surányi</a>, INTEGERS 2013 slides.
%H A231015 D. Andrica and D. Vacaretu, <a href="http://www.cs.ubbcluj.ro/~studia-m/2006-4/andrica.pdf">Representation theorems and almost unimodal sequences</a>, Studia Univ. Babes-Bolyai, Mathematica, Vol. LI, 4 (2006), 23-33.
%H A231015 P. Erdős and J. Surányi, <a href="http://www.renyi.hu/~p_erdos/1959-05.pdf">Egy additív számelméleti probléma</a> (in Hungarian; Russian and German summaries), Mat. Lapok 10 (1959), pp. 284-290.
%F A231015 a(n(n+1)(2n+1)/6) = a(A000330(n)) = n for n > 0.
%F A231015 a((n(n+1)(2n+1)/6)-2) = a(A000330(n)-2) = n for n > 0.
%e A231015 0 = 1^2 + 2^2 - 3^2 + 4^2 - 5^2 - 6^2 + 7^2.
%e A231015 1 = 1^2.
%e A231015 2 = - 1^2 - 2^2 - 3^2 + 4^2.
%e A231015 3 = - 1^2 + 2^2.
%e A231015 4 = - 1^2 - 2^2 + 3^2.
%p A231015 b:= proc(n, i) option remember; local m; m:=i*(i+1)*(2*i+1)/6;
%p A231015       n<=m and (n=m or b(n+i^2, i-1) or b(abs(n-i^2), i-1))
%p A231015     end:
%p A231015 a:= proc(n) local k; for k while not b(n, k) do od; k end:
%p A231015 seq(a(n), n=0..100);  # _Alois P. Heinz_, Nov 03 2013
%t A231015 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_ *)
%Y A231015 Cf. A000330, A158092, A231071, A231272.
%K A231015 nonn,look
%O A231015 0,1
%A A231015 _Jonathan Sondow_, Nov 02 2013
%E A231015 a(4) corrected and a(5)-a(85) from _Donovan Johnson_, Nov 03 2013