A238013 List n copies of each k in {1,2,...,n}, for n=1,2,3,...
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, 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, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5
Offset: 1
Examples
Formatted as table with row lengths given by A002024 = 1, 2,2, 3,3,3, ... the sequence reads: 1 \\ 1 copy of "1"; 1 1 \\ 2 copies of "1", then 2 2 \\ 2 copies of "2"; 1 1 1 \\ 3 copies of "1", then 2 2 2 \\ 3 copies of "2", etc. 3 3 3 \\ 1 1 1 1 \\ 1st row of length 4 => filled with "1"s 2 2 2 2 \\ 2nd row of length 4 => filled with "2"s 3 3 3 3 \\ 3rd row of length 4 => filled with "3"s 4 4 4 4 \\ etc.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
seq(seq(i$j,i=1..j),j=1..10); # Robert Israel, May 29 2017
-
PARI
for(i=1,9,for(j=1,i,for(k=1,i,print1(j","))))
-
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.
-
Python
from sympy import integer_nthroot 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
Formula
a(n) = A237452(n)+1. - Antti Karttunen, Feb 17 2014
Comments