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

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A282887 Sum_{k=0..n} -(-1)^issquare(p(k))*p(k), where p = A282887 is the lexicographic-first permutation of the nonnegative integers such that these sums always remain nonnegative. 3

%I #9 Mar 12 2017 15:23:24

%S 0,1,5,3,0,9,4,20,14,7,32,24,14,3,39,27,14,0,49,34,17,81,63,44,24,3,

%T 84,62,39,15,115,89,62,34,5,126,96,65,33,0,144,110,75,38,0,169,130,90,

%U 49,7,203,160,116,71,25,250,203,155,105,54,2,258,205,151,96,40,329,272,214,155,95,34,358,296,233,168,102,35,396,328,259,189,118

%N Sum_{k=0..n} -(-1)^issquare(p(k))*p(k), where p = A282887 is the lexicographic-first permutation of the nonnegative integers such that these sums always remain nonnegative.

%C In short: add squares, and subtract nonsquares when you can.

%C A variant of A282886 (corresponding to permutation A282840) and A282846 (corresponding to permutation A282864) and A282865; in the latter variants, "square" is replaced by "prime".

%C The graph yields a nice moirée pattern.

%H M. F. Hasler, <a href="/A282887/b282887.txt">Table of n, a(n) for n = 0..5000</a>

%e Starting from a(0)=0 we add the square 1 to get a(1)=1, and since we can't yet subtract 2, we also add the next larger square 4, to get a(2)=5. Then we can subtract nonsquares 2, a(3)=3, and 3, a(4)=0. Now we must add the square 9 to get a(5)=9 before subtracting the nonsquare 5, a(6)=4. Since we can't subtract the nonsquare 6, we add the square 16, a(7)=20. And so on.

%o (PARI) {print1(a=0); c=1; p=2; for(n=1, 199, if(a>=p, a-=p; while(issquare(p++),), a+=c^2; c++); print1(","a))}

%K nonn

%O 0,3

%A _M. F. Hasler_ and _Eric Angelini_, Feb 24 2017

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 April 23 14:49 EDT 2024. Contains 371914 sequences. (Running on oeis4.)