A121997 Count up to n, n times.
1, 1, 2, 1, 2, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7
Offset: 1
Examples
Sequence begins: 1; 1,2; 1,2; 1,2,3; 1,2,3; 1,2,3; ... The blocks of n subblocks of n terms (n=1,2,3,...) can be cast into a square matrices of order n; then the terms are equal to the index of the column they fall into.
Crossrefs
Programs
-
PARI
A121997(N=9)=concat(vector(N,i,concat(vector(i,j,vector(i,k,k))))) \\ Note: this creates a vector; use A121997()[n] to get the n-th term. - M. F. Hasler, Feb 16 2014
-
Python
from sympy import integer_nthroot def A121997(n): return 1+(n-(k:=(m:=integer_nthroot(3*n,3)[0])+(6*n>m*(m+1)*((m<<1)+1)))*(k-1)*((k<<1)-1)//6-1)%k # Chai Wah Wu, Nov 04 2024
Comments