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-6 of 6 results.

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

A074279 n appears n^2 times.

Original entry on oeis.org

1, 2, 2, 2, 2, 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, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
Offset: 1

Views

Author

Jon Perry, Sep 21 2002

Keywords

Comments

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^2 = A000330(n), we have a(A000330(n)) = a(n*(n+1)*(2n+1)/6) = n and a(1+A000330(n)) = a(1+(n*(n+1)*(2n+1)/6)) = n+1. So the current sequence is, loosely speaking, the inverse function of the square pyramidal sequence A000330. A000330 has many alternative formulas, thus yielding many alternative formulas for the current sequence. - Jonathan Vos Post, Mar 18 2006
Partial sums of A253903. - Jeremy Gardiner, Jan 14 2018

Examples

			This can be viewed also as an irregular table consisting of successively larger square matrices:
  1;
  2, 2;
  2, 2;
  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;
  etc.
When this is used with any similarly organized sequence, a(n) is the index of the matrix in whose range n is. A121997(n) (= A237451(n)+1) and A238013(n) (= A237452(n)+1) would then yield the index of the column and row within that matrix.
		

Crossrefs

Programs

  • Mathematica
    Table[n, {n, 0, 6}, {n^2}] // Flatten (* Arkadiusz Wesolowski, Jan 13 2013 *)
  • PARI
    A074279_vec(N=9)=concat(vector(N,i,vector(i^2,j,i))) \\ Note: This creates a vector; use A074279_vec()[n] to get the n-th term. - M. F. Hasler, Feb 17 2014
    
  • PARI
    a(n) = my(k=sqrtnint(3*n,3)); k + (6*n > k*(k+1)*(2*k+1)); \\ Kevin Ryde, Sep 03 2025
    
  • Python
    from sympy import integer_nthroot
    def A074279(n): return (m:=integer_nthroot(3*n,3)[0])+(6*n>m*(m+1)*((m<<1)+1)) # Chai Wah Wu, Nov 04 2024

Formula

For 1 <= n <= 650, a(n) = floor((3n)^(1/3)+1/2). - Mikael Aaltonen, Jan 05 2015
a(n) = 1 + floor( t(n) + 1 / ( 12 * t(n) ) - 1/2 ), where t(n) = (sqrt(3888*(n-1)^2-1) / (8*3^(3/2)) + 3 * (n-1)/2 ) ^(1/3). - Mikael Aaltonen, Mar 01 2015
a(n) = floor(t + 1/(12*t) + 1/2), where t = (3*n - 1)^(1/3). - Ridouane Oudra, Oct 30 2023
a(n) = m+1 if n > m(m+1)(2m+1)/6 and a(n) = m otherwise where m = floor((3n)^(1/3)). - Chai Wah Wu, Nov 04 2024
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/4 (A003881). - Amiram Eldar, Jun 30 2025

Extensions

Offset corrected from 0 to 1 by Antti Karttunen, Feb 08 2014

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

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
Showing 1-6 of 6 results.