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.

A238013 List n copies of each k in {1,2,...,n}, for n=1,2,3,...

This page as a plain text file.
%I A238013 #29 Nov 05 2024 12:18:49
%S A238013 1,1,1,2,2,1,1,1,2,2,2,3,3,3,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,1,1,1,1,
%T A238013 1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5,1,1,1,1,1,1,2,2,2,2,2,2,3,
%U A238013 3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,5,5
%N A238013 List n copies of each k in {1,2,...,n}, for n=1,2,3,...
%C A238013 Consider a sequence of matrices of size 1 X 1, 2 X 2, 3 X 3, etc., then list their elements, read by rows. The present sequence gives the row index of the n-th term of the sequence within "its" matrix, numbered by A074279(n); the column index being given by A121997.
%C A238013 The sequence could be seen as irregular table or triangle with row lengths equal to 1,2,2,3,3,3,4,4,4,4,... = A002024, each row being filled with k's, for the k-th row of given length; see Example.
%H A238013 Robert Israel, <a href="/A238013/b238013.txt">Table of n, a(n) for n = 1..10000</a>
%F A238013 a(n) = A237452(n)+1. - _Antti Karttunen_, Feb 17 2014
%e A238013 Formatted as table with row lengths given by A002024 = 1, 2,2, 3,3,3, ... the sequence reads:
%e A238013 1  \\  1 copy of "1";
%e A238013 1 1  \\  2 copies of "1", then
%e A238013 2 2  \\  2 copies of "2";
%e A238013 1 1 1  \\  3 copies of "1", then
%e A238013 2 2 2  \\  3 copies of "2", etc.
%e A238013 3 3 3  \\
%e A238013 1 1 1 1  \\ 1st row of length 4 => filled with "1"s
%e A238013 2 2 2 2  \\ 2nd row of length 4 => filled with "2"s
%e A238013 3 3 3 3  \\ 3rd row of length 4 => filled with "3"s
%e A238013 4 4 4 4  \\ etc.
%p A238013 seq(seq(i$j,i=1..j),j=1..10); # _Robert Israel_, May 29 2017
%o A238013 (PARI) for(i=1,9,for(j=1,i,for(k=1,i,print1(j","))))
%o A238013 (PARI) A238013_vec(N=9)=concat(vector(N, i, concat(vector(i, j, vector(i, k, i))))) \\ Note: this creates a vector; use A238013_vec()[n] to get the n-th term.
%o A238013 (Python)
%o A238013 from sympy import integer_nthroot
%o A238013 def A238013(n): return (n-1-(k:=(m:=integer_nthroot(3*n,3)[0])+(6*n>m*(m+1)*((m<<1)+1)))*(k-1)*((k<<1)-1)//6)//k+1 # _Chai Wah Wu_, Nov 04 2024
%Y A238013 Cf. A121997, A237451, A237452, A002024, A074279.
%K A238013 nonn,tabf
%O A238013 1,4
%A A238013 _M. F. Hasler_, Feb 16 2014