%I #42 Feb 27 2023 22:51:42
%S 1,1,2,2,1,2,3,2,3,3,1,2,3,4,2,3,4,3,4,4,1,2,3,4,5,2,3,4,5,3,4,5,4,5,
%T 5,1,2,3,4,5,6,2,3,4,5,6,3,4,5,6,4,5,6,5,6,6,1,2,3,4,5,6,7,2,3,4,5,6,
%U 7,3,4,5,6,7,4,5,6,7,5,6,7,6,7,7,1,2,3
%N Concatenation of runs {y..x} for each x>=1, using each y from 1 to x before moving on to the next value for x.
%C Alternate definition: Flattened list of all suffixes (ordered longest to shortest) of the list of all prefixes (ordered shortest to longest) of the list of positive integers. A prefix here is defined as any contiguous sublist of a list which includes the first element, and a suffix as any contiguous sublist of a list which includes the last element.
%C Also, concatenation of runs A002260(n)..A002024(n) for each n>=1.
%H The Nineteenth Byte Stack Exchange chat room, <a href="https://chat.stackexchange.com/transcript/message/61821392">Message regarding this sequence.</a> Some replies are programs to generate terms of the sequence.
%F a(n) = A000120(A087118(n + 1)). - _Thomas Scheuerle_, Feb 16 2023
%F a(n*(n^2 + 5)/6) = a(A004006(n)) = n. This is the earliest appearance of n. - _Thomas Scheuerle_, Sep 30 2022
%e 1
%e 1 2
%e _ 2
%e 1 2 3
%e _ 2 3
%e _ _ 3
%e 1 2 3 4
%e _ 2 3 4
%e _ _ 3 4
%e _ _ _ 4...
%t Print @ Flatten @ (Reverse@FoldList[Join[#2,#]&, {#}&/@Reverse@#]& /@ FoldList[Join, Table[{n},{n,1,10}]])
%o (JavaScript) a=n=>{for(let i=1;++i;){for(let j=0;++j<i;){for(let k=j;k<i;k++){if(!--n){return k}}}}}
%o (MATLAB)
%o function a = A356647( max_x )
%o a = cell2mat(arrayfun(@(x)(cell2mat(arrayfun(@(y)([y:x]),[1:x],'UniformOutput', false))) ...
%o ,[1:max_x],'UniformOutput', false));
%o end % _Thomas Scheuerle_, Sep 30 2022
%o (Python)
%o from itertools import count, islice
%o def agen(): # generator of terms
%o for k in count(1):
%o for j in range(1, k+1):
%o yield from range(j, k+1)
%o print(list(islice(agen(), 87))) # _Michael S. Branicky_, Oct 11 2022
%Y Cf. A000120, A004006, A087118.
%K nonn,easy
%O 1,3
%A _Jonathan Kal-El Peréz_, Aug 19 2022
|