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.

Showing 1-10 of 14 results. Next

A064866 Write numbers 1, then 1 up to 2^2, then 1 up to 3^2, then 1 up to 4^2 and so on.

Original entry on oeis.org

1, 1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28
Offset: 1

Views

Author

Floor van Lamoen, Oct 08 2001

Keywords

Comments

This is a fractal sequence: if the first instance of each number is deleted, the original sequence is recovered. - Franklin T. Adams-Watters, Dec 14 2013
Subsequences start at indices A000330 + 1. - Ralf Stephan, Dec 17 2013
When sequence fills a triangular array by rows, the main diagonal is A064865:
This triangle begins:
1
1 2
3 4 1
2 3 4 5
6 7 8 9 1
From Antti Karttunen, Feb 17 2014: (Start)
A more natural way of organizing this sequence is as an irregular table consisting of successively larger square matrices:
1;
1, 2;
3, 4;
1, 2, 3;
4, 5, 6;
7, 8, 9;
1, 2, 3, 4;
5, 6, 7, 8;
9,10,11,12;
13,14,15,16;
etc.
(End)

Crossrefs

Mini-index to these sequences: A064766, A064865, A064866, A065221-A655234 are all of the same type. See A064766 for a detailed explanation.

Programs

  • Mathematica
    Table[Range[n^2],{n,10}]//Flatten (* Harvey P. Dale, Mar 05 2018 *)
  • PARI
    A064866_vec(N=9)=concat(vector(N, i, vector(i^2, j, j))) \\ Note: This creates a vector; use A064866_vec()[n] to get the n-th term. - M. F. Hasler, Feb 17 2014
    
  • Python
    from sympy import integer_nthroot
    def A064866(n): return n-(k:=(m:=integer_nthroot(3*n,3)[0])+(6*n>m*(m+1)*((m<<1)+1)))*(k-1)*((k<<1)-1)//6 # Chai Wah Wu, Nov 04 2024

Formula

a(n) = A237451(n) + (A237452(n)*A074279(n)) + 1. - M. F. Hasler, Feb 17 2014
For 1 <= n <= 650, a(n) = n - t(t-1)(2t-1)/6, where t = floor((3*n)^(1/3)+1/2). - Mikael Aaltonen, Jan 17 2015
a(n) = n-k(k-1)(2k-1)/6 where k = m+1 if n>m(m+1)(2m+1)/6 and k = m otherwise and m = floor((3n)^(1/3)). - Chai Wah Wu, Nov 05 2024

Extensions

Edited by Ralf Stephan, Dec 17 2013

A121997 Count up to n, n times.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

The n-th block consists of n subblocks, each of which counts from 1 to n.
This a fractal sequence: removing the first instance of each value leaves the original sequence.
The first comment implies that this gives the column index of the n-th element of a sequence whose terms are coefficients, read by rows, of a sequence of matrices of size 1 X 1, 2 X 2, 3 X 3, etc.; cf. example. The row index is given by A238013(n), and the size of the matrix by A074279(n). - M. F. Hasler, Feb 16 2014

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

Cf. A081489 (locations of new values), A075349 (locations of 1's).
Cf. A000290 (row lengths), A002411 (row sums), A036740 (row products).
Cf. A002024 and references there, esp. in PROG section.
Cf. A238013.

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

A237265 Irregular table: n X n matrices (n=1,2,3,...), read by rows filled with numbers 1..n, with k moved to the front in the k-th row.

Original entry on oeis.org

1, 1, 2, 2, 1, 1, 2, 3, 2, 1, 3, 3, 1, 2, 1, 2, 3, 4, 2, 1, 3, 4, 3, 1, 2, 4, 4, 1, 2, 3, 1, 2, 3, 4, 5, 2, 1, 3, 4, 5, 3, 1, 2, 4, 5, 4, 1, 2, 3, 5, 5, 1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 2, 1, 3, 4, 5, 6, 3, 1, 2, 4, 5, 6, 4, 1, 2, 3, 5, 6, 5, 1, 2, 3, 4, 6, 6, 1, 2, 3, 4, 5
Offset: 1

Views

Author

R. J. Cano, Feb 09 2014

Keywords

Comments

Cases of enumeration in ascending order for the first m positive integers when one of them, j, is previously excluded (m=1,2,3,..., 1 <= j <= m).
Table of the k initial permutations, one per block, when all the k! permutations in lexicographic ascending order are split uniformly into k blocks. Such table read by rows for k=1,2,3,... .
These permutations might be considered the initial inputs for a parallel/distributed variant of the Narayana Pandita's algorithm. Such variant would deliver to each thread/core/host one or more of the mentioned inputs, then the remaining permutations can be obtained with (k-1)!-1 executions of the classic Narayana Pandita's algorithm for the next permutation in lexical order.
The terms of A237450 give the positions of rows of this table among the rows of A030298. The finite n X n square matrices converge towards the infinite square array A237447. Please see further comments there. - Antti Karttunen, Feb 10 2014
Alternative way to express this is that each row k=1..n of each n X n matrix contains the lexicographically earliest n-letter permutation beginning with number k, or equally, that each of the n X n square matrices contain in their n rows those n-letter permutations of the symmetric group S_n that correspond to the inverses of cycles (1), (1 2), (1 2 3), ..., (1 2 ... n). Please see the Example section. - Antti Karttunen, Feb 12 2014

Examples

			By excluding 2, the natural numbers between 1 and 4 are 1,3,4, then the second row of the corresponding matrix must be [2,1,3,4] and a(22)=4; that is, when reading by rows, a(22) must be placed at the 4th matrix since 22 is greater than the sum of elements there in the preceding matrices and it is smaller than the next of such sums: 14 = (1 + 2^2 + 3^2) <= (22) <= (1 + 2^2 + 3^2 + 4^2) = 30. Therefore 14 is subtracted from 22 leaving 8. This means that a(22) is the 8th element in the fourth matrix read by rows, so a(22) = A(4)[2,4] (see formula).
The irregular table starts consists of successively larger squares (beginning with a 1 X 1 square {1}), where each larger (n+1) X (n+1) square contains the previous n X n square in its upper left corner, with the first n rows followed by n+1, and the last row consisting of (n+1) followed by the first row of the previous n X n square (i.e., terms 1, 2, ..., n):
Permutation  In cycle notation.  Inverse in cycle notation
1;           ( )                 ( )    [Note: ( ) stands for identity]
1,2;         ( )                 ( )
2,1;         (1 2)               (1 2)
1,2,3;       ( )                 ( )
2,1,3;       (1 2)               (1 2)
3,1,2;       (1 3 2)             (1 2 3)
1,2,3,4;     ( )                 ( )
2,1,3,4;     (1 2)               (1 2)
3,1,2,4;     (1 3 2)             (1 2 3)
4,1,2,3;     (1 4 3 2)           (1 2 3 4)
1,2,3,4,5;   ( )                 ( )
2,1,3,4,5;   (1 2)               (1 2)
3,1,2,4,5;   (1 3 2)             (1 2 3)
4,1,2,3,5;   (1 4 3 2)           (1 2 3 4)
5,1,2,3,4;   (1 5 4 3 2)         (1 2 3 4 5)
...
The table starts with 1 since the definition must be read in the mathematical sense of its statement. If we have N elements and one of them must be excluded, there are no elements available to exclude when N=1.
		

References

  • Donald Knuth, The Art of Computer Programming, Volume 4: "Generating All Tuples and Permutations" Fascicle 2, first printing. Addison-Wesley, 2005. ISBN 0-201-85393-0.

Crossrefs

Programs

Formula

a(n) = A237447(1 + ((1/2) * ((col+row)^2 + col + 3*row)))[where col = A237451(n) and row = A237452(n)] = A237447bi(A237452(n),A237451(n)) [where A237447bi(row,col) is square array A237447 considered as a bivariate function]. - Antti Karttunen, Feb 10-12 2014

Extensions

Name changed and more terms added by Antti Karttunen, Feb 10 2014
Further edits by M. F. Hasler, Mar 09 2014

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

Original entry on oeis.org

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

Views

Author

M. F. Hasler, Feb 16 2014

Keywords

Comments

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.
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.

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.
		

Crossrefs

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

A237451 Zero-based column index to irregular tables organized as successively larger square matrices.

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5
Offset: 1

Views

Author

Antti Karttunen, Feb 08 2014

Keywords

Comments

With sequences constructed of successively larger square matrices (cf. A074279), a(n) will return the distance of n from the left edge of the matrix that n is located in, with 0 standing for the leftmost column (please see the Example section).
A237452 gives the corresponding row index.
A238013 and A121997 give these same row and column indices, starting the numbering with index 1. - M. F. Hasler, Feb 17 2014

Examples

			This irregular table begins as:
0;
0,1;
0,1;
0,1,2;
0,1,2;
0,1,2;
0,1,2,3;
0,1,2,3;
0,1,2,3;
0,1,2,3;
0,1,2,3,4;
0,1,2,3,4;
0,1,2,3,4;
0,1,2,3,4;
0,1,2,3,4;...
		

Crossrefs

Programs

  • Python
    from sympy import integer_nthroot
    def A237451(n): return (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
  • Scheme
    (define (A237451 n) (modulo (-1+ (A064866 n)) (A074279 n)))
    

Formula

a(n) = (A064866(n)-1) modulo A074279(n).
a(n) = A121997(n)-1. - M. F. Hasler, Feb 16 2014

A237452 Zero-based row index to irregular tables organized as successively larger square matrices.

Original entry on oeis.org

0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 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

Views

Author

Antti Karttunen, Feb 08 2014

Keywords

Comments

With sequences constructed of successively larger kxk square matrices (cf. A074279), a(n) will return the distance of n from the top edge of the matrix that n is located in, with 0 standing for the topmost row in that matrix (please see the Example section).
A237451 gives the corresponding column index.
A238013 and A121997 give these same row and column indices, but starting the numbering with index 1. - M. F. Hasler, Feb 17 2014

Examples

			This irregular table begins as:
0;
0,0;
1,1;
0,0,0;
1,1,1;
2,2,2;
0,0,0,0;
1,1,1,1;
2,2,2,2;
3,3,3,3;
0,0,0,0,0;
1,1,1,1,1;
2,2,2,2,2;
3,3,3,3,3;
4,4,4,4,4;
...
		

Crossrefs

Programs

  • Python
    from sympy import integer_nthroot
    def A237452(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 # Chai Wah Wu, Nov 04 2024
  • Scheme
    (define (A237452 n) (floor->exact (/ (-1+ (A064866 n)) (A074279 n))))
    

Formula

a(n) = floor((A064866(n)-1)/A074279(n)).
a(n) = A238013(n)-1. - M. F. Hasler, Feb 16 2014

A108582 n appears n^3 times.

Original entry on oeis.org

1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5
Offset: 1

Views

Author

Jonathan Vos Post, Jul 25 2005

Keywords

Comments

From Jonathan Vos Post, Mar 18 2006: (Start)
The key to this sequence is: 1^3 + 2^3 + 3^3 + ... + n^3 = (1+2+3+...+n)^2.
Since the last occurrence of n comes one before the first occurrence of n+1 and the former is at Sum_{i=0..n} i^3 = A000537(n) = (A000217(n))^2 = (n*(n+1)/2)^2 = (C(n+1,2))^2, have a(A000537(n)) = a((A000217(n))^2) = n and thus a(1+A000537(n)) = a(1+(A000217(n))^2) = n+1.
The current sequence is, loosely, the inverse function of the square of the triangular number sequence. (End)

Crossrefs

Programs

  • Mathematica
    Flatten @ Table[ Table[k, {k^3}], {k, 5}] (* Giovanni Resta, Jun 17 2016 *)
    a[n_]:=Ceiling[1/2 (Sqrt[8 Sqrt[n]+1]-1)]
    Nmax=225; Table[a[n],{n,1,Nmax}] (* Boris Putievskiy, Jun 19 2024 *)
  • Python
    from sympy import integer_nthroot
    def A108582(n): return (m:=integer_nthroot(k:=n<<2,4)[0])+(k>(m*(m+1))**2) # Chai Wah Wu, Nov 04 2024

Formula

a(n) = ceiling((1/2)*(sqrt(8*sqrt(n) + 1) - 1)). - Boris Putievskiy, Jun 19 2024
From Chai Wah Wu, Nov 04 2024: (Start)
a(n) = m+1 if n>(m(m+1))^2/4 and a(n) = m otherwise where m = floor((4n)^(1/4)).
More generally, for a sequence a_k(n) where n appears n^(k-1) times, a_k(n) = m+1 if n > Sum_{i=1..m} i^(k-1) and a_k(n) = m otherwise where m = floor((kn)^(1/k)).
Note that Sum_{i=1..m} i^(k-1) can be written as a k-th order polynomial of m using Faulhaber's formula. (End)

Extensions

Two missing terms from Giovanni Resta, Jun 17 2016

A213083 Each square n^2 appears n^2 number of times.

Original entry on oeis.org

1, 4, 4, 4, 4, 9, 9, 9, 9, 9, 9, 9, 9, 9, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36
Offset: 1

Views

Author

Jens Ahlström, Jun 05 2012

Keywords

Crossrefs

Programs

  • Mathematica
    Flatten[Table[Table[n^2, {n^2}], {n, 6}]] (* T. D. Noe, Jun 05 2012 *)
  • Python
    from sympy.core.intfunc import integer_nthroot
    def A213083(n): return ((m:=integer_nthroot(3*n,3)[0])+(6*n>m*(m+1)*((m<<1)+1)))**2 # Chai Wah Wu, Jun 21 2025

Formula

a(n) = A074279(n)^2. Alternatively, a(n) = (m+1)^2 if n > m(m+1)(2m+1)/6 and a(n) = m^2 otherwise where m = floor((3n)^(1/3)). - Chai Wah Wu, Jun 21 2025
Sum_{n>=1} (-1)^(n+1)/a(n) = A006752. - Amiram Eldar, Jun 30 2025

A108581 Positive triangular numbers repeated their own number of times.

Original entry on oeis.org

1, 3, 3, 3, 6, 6, 6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28
Offset: 1

Views

Author

Jonathan Vos Post, Jul 25 2005

Keywords

Comments

In terms of the repetition convolution operator #, where (sequence A) # (sequence B) = the sequence consisting of A(n) copies of B(n), then this sequence is the repetition self-convolution (A000217(n)-0) # (A000217(n)-0). Over the set of positive infinite integer sequences, # gives a nonassociative noncommutative groupoid with a left identity (A000012) but no right identity, where the left identity is also a right nullifier and idempotent.

Crossrefs

Programs

  • Python
    from sympy import integer_nthroot
    def A108581(n): return (r:=(m:=integer_nthroot(k:=6*n,3)[0])+(k>m*(m+1)*(m+2)))*(r+1)>>1 # Chai Wah Wu, Nov 07 2024

Formula

a(1) = 1, for n>1: a(A000217(n)-1) = a(A000217(n)) = ... = a(A000217(n+1)-2) = A000217(n).
a(n) = A000217(m+1) if 6n>m(m+1)(m+2) and a(n) = A000217(m) otherwise where m = floor((6n)^(1/3)). - Chai Wah Wu, Nov 07 2024

A253902 Write numbers 1, then 2^2 down to 1, then 3^2 down to 1, then 4^2 down to 1 and so on.

Original entry on oeis.org

1, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
Offset: 1

Views

Author

Mikael Aaltonen, Jan 18 2015

Keywords

Comments

Triangle read by rows in which row n lists the first n^2 positive integers in decreasing order, n >= 1. - Omar E. Pol, Jan 20 2015

Examples

			From _Omar E. Pol_, Jan 20 2015: (Start)
Written as an irregular triangle in which row lengths are successive squares, the sequence begins:
   1;
   4,  3,  2,  1;
   9,  8,  7,  6,  5,  4,  3, 2, 1;
  16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1;
  ...
(End)
		

Crossrefs

Programs

  • Maple
    T:= n-> (t-> seq(t-i, i=0..t-1))(n^2):
    seq(T(n), n=1..6);  # Alois P. Heinz, Nov 05 2024
  • Mathematica
    a253902[n_] := Flatten@ Table[Reverse[Range[i^2]], {i, n}]; a253902[6] (* Michael De Vlieger, Jan 19 2015 *)
  • PARI
    lista(nn=10) = {for (n=1, nn, forstep(k=n^2, 1, -1, print1(k, ", ");););} \\ Michel Marcus, Jan 20 2015
    
  • Python
    from sympy import integer_nthroot
    def A253902(n): return (k:=(m:=integer_nthroot(3*n,3)[0])+(6*n>m*(m+1)*((m<<1)+1))+2)*(k*((k<<1)-9)+13)//6-n # Chai Wah Wu, Nov 05 2024

Formula

For 1 <= n <= 650, a(n) = -n + (t + 2)*(2*t^2 - t + 3)/6, where t = floor((3*n)^(1/3)+1/2).
a(n) = k*(2*k^2-9*k+13)/6-n where k = floor((3*n)^(1/3))+3 if n>A000330(floor((3*n)^(1/3))) and k = floor((3*n)^(1/3))+2 otherwise. - Chai Wah Wu, Nov 05 2024
Showing 1-10 of 14 results. Next