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.

Previous Showing 21-30 of 42 results. Next

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

A030495 a(n) = (n+1)! + n.

Original entry on oeis.org

1, 3, 8, 27, 124, 725, 5046, 40327, 362888, 3628809, 39916810, 479001611, 6227020812, 87178291213, 1307674368014, 20922789888015, 355687428096016, 6402373705728017, 121645100408832018, 2432902008176640019, 51090942171709440020, 1124000727777607680021, 25852016738884976640022
Offset: 0

Views

Author

Keywords

Comments

Numbers m such that n!*C(m,n) = C(m,n+1). - Lekraj Beedassy, Feb 18 2006
a(n) is also the maximum size for a deck of cards in the Communicating the Card magic trick. In this game Alice draws n+1 cards from the deck at random, without replacement, and passes n of them, one by one, to her accomplice Bob. If the deck has a(n) cards or fewer, there is an algorithm by which Alice can communicate to Bob the identity of the card she chooses to retain, using only the identity and the order of passing of the n passed cards. (One side of the proof, that no larger deck size will work, is easy: the retained card can be one of (n+1)! possibilities, since Bob knows that it is not one of the n passed cards. Alice has (n+1) ways to retain a card and n! ways to order the passing of the remaining cards, so she cannot communicate more than (n+1)! different possibilities.) - Lee A. Newberg, Jun 09 2010

Examples

			a(5) = (5+1)!+5 = 725.
		

Crossrefs

a(n) = least k such that s(k) = n, where s=A030298.
Equals A005095(n+1) - 1.

Programs

Formula

a(n) = n + Sum_{k=1..n-1} k*k!.
E.g.f.: 1/(1 - x)^2 + exp(x)*x . - Stefano Spezia, Jun 06 2024

Extensions

Better description from Jason Earls, Mar 24 2001

A178475 Permutations of 12345: Numbers having each of the decimal digits 1,...,5 exactly once, and no other digit.

Original entry on oeis.org

12345, 12354, 12435, 12453, 12534, 12543, 13245, 13254, 13425, 13452, 13524, 13542, 14235, 14253, 14325, 14352, 14523, 14532, 15234, 15243, 15324, 15342, 15423, 15432, 21345, 21354, 21435, 21453, 21534, 21543, 23145, 23154, 23415
Offset: 1

Views

Author

M. F. Hasler, May 28 2010

Keywords

Comments

There are 5! = 120 terms in this finite subsequence of A030299.
It would be interesting to conceive simple and/or efficient functions which yield (a) the n-th term of this sequence: f(n) = a(n), (b) for a given term, the subsequent one: f(a(n)) = a(1 + (n mod 5!)).
From Nathaniel Johnston, May 19 2011: (Start)
Individual terms a(n) can be computed efficiently via the following procedure: Define b(n,k) = 1 + floor(((n-1) mod (k+1)!)/k!) for k = 1, 2, 3, 4. The first digit of a(n) is b(n,4). The second digit of a(n) is the b(n,3)-th number not already used. The third digit of a(n) is the b(n,2)-th number not already used. The fourth digit of a(n) is the b(n,1)-th number not already used, and the final digit of a(n) is the only digit remaining. This procedure generalizes in the obvious way for related sequences such as A178476.
For example, if n = 38 then we compute b(38,1) = 2, b(38,2) = 1, b(38,3) = 3, b(38,4) = 2. Thus a(38) = 24153 (2, followed by the 3rd digit not yet used, followed by the 1st digit not yet used, followed by the 2nd digit not yet used, followed by the last remaining digit).
(End)

Crossrefs

Programs

  • Mathematica
    FromDigits/@Permutations[Range[5]] (* Harvey P. Dale, Jan 19 2019 *)
  • PARI
    A178475(n)={my(b=vector(4,k,1+(n-1)%(k+1)!\k!),t=b[4],d=vector(4,i,i+(i>=t)));for(i=1,3,t=10*t+d[b[4-i]];d=vecextract(d,Str("^"b[4-i])));t*10+d[1]} \\ - M. F. Hasler (following N. Johnston's comment), Jan 10 2012
    
  • PARI
    v=vector(5,i,10^(i-1))~; A178475=vecsort(vector(5!,i,numtoperm(5,i)*v))
    is_A178475(x)={ vecsort(Vecsmall(Str(x)))==Vecsmall("12345") }
    forstep( m=12345,54321,9, is_A178475(m) & print1(m","))

Formula

a(n) + a(5! + 1 - n) = 66666.
floor( a(n) / 10^4 ) = ceiling( n / 4! ).
a(n) = A030299(n+33).
a(n) == 6 (mod 9).
a(n) = 6 + 9*A178485(n).

A130664 a(1)=1. a(n) = a(n-1) + (number of terms from among a(1) through a(n-1) which are factorials).

Original entry on oeis.org

1, 2, 4, 6, 9, 12, 15, 18, 21, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200, 205, 210, 215, 220, 225, 230, 235, 240, 245, 250
Offset: 1

Views

Author

Leroy Quet, Jun 21 2007

Keywords

Comments

Also this is an irregular array where row n contains the n! consecutive multiples of n starting with n!.
For n >= 1, (a(n), A084555(n)) = (1,1), (2,3), (4,5), (6,8), (9,11), (12,14), ... gives the starting and ending offsets of the n-th permutation in the sequences like A030298 and A030496. Gives also the fixed points of A220662; we have A220662(a(n)) = a(n). - Antti Karttunen, Dec 18 2012

Examples

			When interpreted as an irregular table, the rows begin as:
  1;
  2, 4;
  6, 9, 12, 15, 18, 21;
		

Crossrefs

Programs

  • Maple
    A[1]:= 1:
    nextf:= 2!:
    m:= 1:
    for n from 2 to 100 do
      A[n]:= A[n-1]+m;
      if A[n] = nextf then
         m:= m+1;
          nextf:= (m+1)!;
      fi;
    od:
    seq(A[i],i=1..100); # Robert Israel, Apr 28 2016
  • Mathematica
    Table[Range[n!, (n + 1)! - 1, n], {n, 5}] // Flatten (* Michael De Vlieger, Aug 29 2017 *)
  • Scheme
    (define (A130664 n) (+ 1 (A084555(- n 1))))

Formula

a(n) = A084555(n-1) + 1.

A178476 Permutations of 123456: Numbers having each of the decimal digits 1,...,6 exactly once, and no other digit.

Original entry on oeis.org

123456, 123465, 123546, 123564, 123645, 123654, 124356, 124365, 124536, 124563, 124635, 124653, 125346, 125364, 125436, 125463, 125634, 125643, 126345, 126354, 126435, 126453, 126534, 126543, 132456, 132465, 132546, 132564, 132645, 132654
Offset: 1

Views

Author

M. F. Hasler, May 28 2010

Keywords

Comments

This finite sequence contains 6!=720 terms.
This is a subsequence of A030299, consisting of elements A030299(154)..A030299(873).
If individual digits are be split up into separate terms, we get a subsequence of A030298.
It would be interesting to conceive simple and/or efficient functions which yield (a) the n-th term of this sequence: f(n)=a(n), (b) for a given term, the subsequent one: f(a(n)) = a(1 + (n mod 6!)).
The expression a(n+6) - a(n) takes only 18 different values for n = 1..6!-6.
An efficient procedure for generating the n-th term of this sequence can be found at A178475. - Nathaniel Johnston, May 19 2011
From Hieronymus Fischer, Feb 13 2013: (Start)
The sum of all terms as decimal numbers is 279999720.
General formula for the sum of all terms (interpreted as decimal permutational numbers with exactly d different digits from the range 1..d < 10): sum = (d+1)!*(10^d-1)/18.
If the terms are interpreted as base-7 numbers the sum is 49412160.
General formula for the sum of all terms of the corresponding sequence of base-p permutational numbers (numbers with exactly p-1 different digits excluding the zero digit): sum = (p-2)!*(p^p-p)/2. (End)

Crossrefs

Programs

  • Mathematica
    Take[FromDigits/@Permutations[Range[6]],40] (* Harvey P. Dale, Jun 05 2012 *)
  • PARI
    v=vector(6,i,10^(i-1))~; A178476=vecsort(vector(6!,i,numtoperm(6,i)*v));
    is_A178476(x)= { vecsort(Vec(Str(x)))==Vec("123456") }
    forstep( m=123456,654321,9, is_A178476(m) & print1(m","))

Formula

a(n) + a(6! + 1 - n) = 777777.
floor( a(n) / 10^5 ) = ceiling( n / 5! ).
a(n) = A030299(n+153).
a(n) == 3 (mod 9).
a(n) = 3 + 9*A178486(n).

A178485 (A178475(n)-6)/9.

Original entry on oeis.org

1371, 1372, 1381, 1383, 1392, 1393, 1471, 1472, 1491, 1494, 1502, 1504, 1581, 1583, 1591, 1594, 1613, 1614, 1692, 1693, 1702, 1704, 1713, 1714, 2371, 2372, 2381, 2383, 2392, 2393, 2571, 2572, 2601, 2605, 2612, 2615, 2681, 2683, 2701, 2705, 2723, 2725
Offset: 1

Views

Author

M. F. Hasler, May 28 2010

Keywords

Comments

There are 5!=120 terms in this finite sequence. Its origin is the fact that numbers whose decimal expansion is a permutation of 12345 are all of the form 9k+6.

Crossrefs

Programs

  • PARI
    v=vector(5,i,10^(i-1))~; vecsort(vector(5!,i,numtoperm(5,i)*v))
    is_A178475(x)= { vecsort(Vec(Str(x)))==Vec("12345") }
    forstep( m=12345,54321,9, is_A178475(m) & print1(m","))

Formula

a(n) + a(5!+1-n) = 7406.
a(n) == 1, 2, 3, 4 or 5 (mod 10).
a(n+6)-a(n) is an element of { 100, 110, 111, 200, 220, 222, 679 }.
a(n+6)-a(n) = 679 iff (n-1)%24 > 17, where % denotes the remainder upon division.
a(n+6)-a(n) = 200, 220 or 222 iff (n-1)%30 > 23, i.e. n==25,...,30 (mod 30).

A178486 (A178476(n)-3)/9.

Original entry on oeis.org

13717, 13718, 13727, 13729, 13738, 13739, 13817, 13818, 13837, 13840, 13848, 13850, 13927, 13929, 13937, 13940, 13959, 13960, 14038, 14039, 14048, 14050, 14059, 14060, 14717, 14718, 14727, 14729, 14738, 14739, 14917, 14918, 14947, 14951, 14958, 14961
Offset: 1

Views

Author

M. F. Hasler, May 28 2010

Keywords

Comments

The sequence is motivated by the fact that numbers whose decimal expansion is a permutation of 123456, are all of the form 9k+3.
There are 6!=720 terms in this finite sequence.

Crossrefs

Programs

  • PARI
    forstep( m=123456,654321/*or less*/,9, is_A178476(m) & print1(m\9",")) /*cf. A178476*/

Formula

a(n) + a(6!+1-n) = 86419.
a(n) == 0, 1, 2, 7, 8 or 9 (mod 10).

A207324 List of permutations of 1,2,3,...,n for n=1,2,3,..., in the order they are output by Steinhaus-Johnson-Trotter algorithm.

Original entry on oeis.org

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

Views

Author

R. J. Cano, Sep 14 2012

Keywords

Comments

This table is otherwise similar to A030298, but lists permutations in the order given by the Steinhaus-Trotter-Johnson algorithm. - Antti Karttunen, Dec 28 2012

Examples

			For the set of the first two natural numbers {1,2} the unique permutations possible are 12 and 21, concatenated with 1 for {1} the resulting sequence would be 1, 1, 2, 2, 1.
If we consider up to 3 elements {1,2,3}, we have 123, 132, 312, 321, 231, 213 and the concatenation gives: 1, 1, 2, 2, 1, 1, 2, 3, 1, 3, 2, 3, 1, 2, 3, 2, 1, 2, 3, 1, 2, 1, 3.
Up to N concatenations, the sequence will have a total of Sum_{k=1..N} (k! * k) = (N+1)! - 1 = A033312(N+1) terms.
		

Crossrefs

Cf. A001563 (row lengths), A001286 (row sums).
Pair (A130664(n),A084555(n)) = (1,1),(2,3),(4,5),(6,8),(9,11),(12,14),... gives the starting and ending offsets of the n-th permutation in this list.

Extensions

A220660 Irregular table, where the n-th row consists of numbers 0..(n!-1).

Original entry on oeis.org

0, 0, 1, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, 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, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39
Offset: 1

Views

Author

Antti Karttunen, Dec 18 2012

Keywords

Comments

Used for computing A030298: a(n) tells the zero-based ranking of the n-th permutation in A030298 (A030299(n)) in the lexicographical ordering of all finite permutations of the same size.

Examples

			Rows of this irregular table begin as:
0;
0, 1;
0, 1, 2, 3, 4, 5;
		

Crossrefs

Programs

Formula

a(n) = n - A007489(A084556(n)-1) - 1.
a(n) = A220661(n)-1.

A178477 Permutations of 1234567: Numbers having each of the decimal digits 1,...,7 exactly once, and no other digit.

Original entry on oeis.org

1234567, 1234576, 1234657, 1234675, 1234756, 1234765, 1235467, 1235476, 1235647, 1235674, 1235746, 1235764, 1236457, 1236475, 1236547, 1236574, 1236745, 1236754, 1237456, 1237465, 1237546, 1237564, 1237645, 1237654
Offset: 1

Views

Author

M. F. Hasler, Oct 09 2010

Keywords

Comments

It would be nice to have a simple explicit formula for the n-th term.
Contains A000142(7) = 5040 terms. - R. J. Mathar, Apr 08 2011
An efficient procedure for generating the n-th term of this sequence can be found at A178475. - Nathaniel Johnston, May 19 2011

Crossrefs

Programs

  • Mathematica
    FromDigits/@Take[Permutations[Range[7]],50] (* Harvey P. Dale, Nov 11 2012 *)
  • PARI
    is_A178477(x)= { vecsort(Vec(Str(x)))==Vec("1234567") }
Previous Showing 21-30 of 42 results. Next