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.

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.

This page as a plain text file.
%I A306470 #25 Apr 16 2025 21:13:23
%S A306470 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 A306470 17,51,16,15,31,181,30,50,29,78,28,49,27,119,26,48,25,77,24,23,47,615,
%U A306470 46,76,45,118,44,75,43,180,42,74,41,117,40,73
%N 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.
%C A306470 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 A306470 Jan Koornstra, <a href="/A306470/b306470.txt">Table of n, a(n) for n = 0..10000</a>
%e A306470 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 A306470 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 A306470 (Python)
%o A306470 seq = [0]
%o A306470 for n in range(1, 1387):
%o A306470   num_blanks = seq.count(-1)
%o A306470   if num_blanks >= n: seq[[index for index, value in enumerate(seq) if value == -1][num_blanks - n]] = n
%o A306470   else: seq += [n] + [-1] * n
%o A306470 print(seq[:100])
%Y A306470 Cf. A112088.
%K A306470 nonn,easy,look
%O A306470 0,3
%A A306470 _Jan Koornstra_, Feb 17 2019