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.

A343611 Partial sums of A345967.

This page as a plain text file.
%I A343611 #17 Jul 21 2021 09:47:04
%S A343611 0,2,1,6,3,9,5,12,4,16,7,18,8,23,10,27,13,29,11,33,14,35,15,40,17,43,
%T A343611 19,47,20,50,21,53,22,57,24,60,26,63,25,67,28,71,31,75,34,79,32,78,30,
%U A343611 85,36,87,37,90,38,95,41,97,39,101,42,105,45,109,48,113,46,112,44,118,49,121,51
%N A343611 Partial sums of A345967.
%C A343611 Explicitly, this is the sequence of distinct nonnegative integers such that the sequence of first differences d(n) = a(n+1) - a(n) has alternating signs, distinct nonnegative partial sums, and the absolute values are all distinct and the lexicographically earliest sequence formed that way.
%C A343611 The first differences are (2, -1, 5, -3, 6, -4, 7, -8, 12, -9, 11, -10, 15, ...). Taking absolute values yields sequence S = A345967 which is the lexico-earliest sequence of distinct positive integers such that the alternating partial sums (i.e., a(n) = Sum_{k=1..n} -(-1)^k S(k), n >= 0) give all nonnegative integers exactly once.
%H A343611 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A343611 a(n) = Sum_{k=1..n} -(-1)^n * A345967(k), n >= 0.
%o A343611 (PARI) A343611_vec(Nmax, P=0)={ my(US=[0], UP=[P], used(x, U)= setsearch(U, x) || x<=U[1], insert(x, U)= U=setunion(U, [x]); while(#U>1&&U[2]==U[1]+1, U=U[^1]); U); vector(Nmax, n, my(s=(-1)^n); for(S=US[1]+1, oo, (used(S, US) || used(P-s*S, UP))&&next; if(s<0, my(f=1); for(PP=UP[1]+1, P+S-1, used(PP, UP) || used(P+S-PP, US) || PP==P || [f=0; break]); f && next); UP=insert(P-=s*S, UP); US=insert(S, US); break); P)} \\ Gives the vector a(1..Nmax), i.e., without a(0)=0.
%Y A343611 Cf. A345967.
%K A343611 nonn
%O A343611 0,2
%A A343611 _M. F. Hasler_, Jul 11 2021