The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A306470 a(0) = 0; for n > 0, if the number of blanks already in the sequence is greater than or equal to n, n is filled in at the n-th blank counting from the end of the sequence; otherwise n is added to the end of the sequence followed by n blanks. 3

%I #22 Apr 01 2019 02:03:20

%S 0,1,3,2,9,5,4,120,8,14,7,6,22,13,34,12,21,11,10,52,20,33,19,79,18,32,

%T 17,51,16,15,31,181,30,50,29,78,28,49,27,119,26,48,25,77,24,23,47,615,

%U 46,76,45,118,44,75,43,180,42,74,41,117,40,73

%N a(0) = 0; for n > 0, if the number of blanks already in the sequence is greater than or equal to n, n is filled in at the n-th blank counting from the end of the sequence; otherwise n is added to the end of the sequence followed by n blanks.

%C The consecutive number of blanks added to the sequence (1, 2, 4, 6, 10, 15, ...) appear to form the sequence A112088 - 1. The unique values for the length of the sequence (1, 3, 6, 11, 18, 29, 45, 69, 105, ...) then becomes 1 + the partial sums of A112088.

%H Jan Koornstra, <a href="/A306470/b306470.txt">Table of n, a(n) for n = 0..10000</a>

%e For n < 3, n is added to the sequence along with n blanks (denoted by -1): [0, 1, -1, 2, -1, -1]. There are now three blanks in the sequence, hence n = 3 is filled in at the third blank counting from the end of the sequence: [0, 1, 3, 2, -1, -1].

%t TakeWhile[Nest[Function[{a, n, b}, If[b >= n, ReplacePart[a, Position[a, -1][[-n]] -> n ], Join[a, Prepend[ConstantArray[-1, n], n]]]] @@ {#, Max@ # + 1, Count[#, -1]} &, {0}, 10^3], # > -1 &] (* _Michael De Vlieger_, Mar 24 2019 *)

%o (Python 3)

%o seq = [0]

%o for n in range(1, 1387):

%o num_blanks = seq.count(-1)

%o if num_blanks >= n: seq[[index for index, value in enumerate(seq) if value == -1][num_blanks - n]] = n

%o else: seq += [n] + [-1] * n

%o print(seq[:100])

%Y Cf. A112088.

%K nonn,easy,look

%O 0,3

%A _Jan Koornstra_, Feb 17 2019

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 May 16 05:56 EDT 2024. Contains 372549 sequences. (Running on oeis4.)