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 33 results. Next

A220664 First differences of A030299.

Original entry on oeis.org

11, 9, 102, 9, 81, 18, 81, 9, 913, 9, 81, 18, 81, 9, 702, 9, 171, 27, 72, 18, 693, 18, 72, 27, 171, 9, 702, 9, 81, 18, 81, 9, 8024, 9, 81, 18, 81, 9, 702, 9, 171, 27, 72, 18, 693, 18, 72, 27, 171, 9, 702, 9, 81, 18, 81, 9, 5913, 9, 81, 18, 81, 9, 1602, 9, 261
Offset: 1

Views

Author

Antti Karttunen, Dec 17 2012

Keywords

Comments

From M. F. Hasler, Jan 12 2013: (Start)
Note [updated Mar 03 2013]: The definition of sequence A030299 has been slightly modified in Jan. 2013, and as a consequence the following properties remain valid beyond the first A007489(9)-1 = 409112 terms, which had not been the case before, when A030299 had been defined through concatenation of the lexicographically ordered permutations, which in case of elements >= 10 broke up the nice mathematical properties (esp. of the sequence A219664 = 9*A217626 cited below).
This sequence taken modulo 9 is zero except (possibly) at indices where a run of permutations ends in A030299. (These indices are given by A007489(n), n>0.) There it equals (mod 9) the "n" of the following run. E.g., a(1)=2 (mod 9), and A030299(1+1)=12 is the start of the run for n=2; a(3)=3 (mod 9) and A030299(3+1)=123 is the start of the run for n=3, a(9)=4 (mod 9) and A030299(9+1)=1234 is the start of the run for n=4, etc.
The subsequence between these indices (A007489(n)+1,...,A007489(n+1)-1), always starts with the same terms, listed in A219664 = 9*A217626 (= A209280 = A107346 where the latter are defined). (End)

Examples

			A030299 starts (1, 12, 21, 123, 132, 213, 231, 312, ...), the first differences thereof yield (11, 9, 102, 9, 81, 18, 81, ...).
		

Crossrefs

The repeating part is given by A219664, equal to A107346 for indices < 5!.

Programs

  • Maple
    (l-> seq(l[j]-l[j-1], j=2..nops(l)))([seq(map(x-> parse(cat(x[])),
         combinat[permute](n))[], n=0..5)])[];  # Alois P. Heinz, Nov 09 2021
  • PARI
    {A030299=concat( vector( 5,k, vecsort( vector( (#k=vector(k, j, 10^j)~\10)!, i, numtoperm(#k, i-1)*k )))); A220664=vecextract(A030299,"^1")-vecextract(A030299,"^-1")} \\ M. F. Hasler, Jan 12 2013
    
  • Python
    from itertools import permutations
    def pmap(s, m): return sum(s[i-1]*10**(m-i) for i in range(1, len(s)+1))
    def agen():
        m = 1
        while True:
            for s in permutations(range(1, m+1)): yield pmap(s, m)
            m += 1
    def aupton(terms):
        alst, g = [], agen()
        t = next(g)
        while len(alst) < terms:
            t, prevt = next(g), t
            alst += [t - prevt]
        return alst
    print(aupton(65)) # Michael S. Branicky, Nov 09 2021
  • Scheme
    (define (A220664 n) (- (A030299 (+ 1 n)) (A030299 n)))
    

Formula

a(n) = A030299(n+1) - A030299(n).
a(n) = A219664(n-A007489(k)), for A007489(k) < n < A007489(k+1). - M. F. Hasler, Jan 13 2013

A352329 Squares in A030299.

Original entry on oeis.org

1, 13527684, 34857216, 65318724, 73256481, 81432576, 139854276, 152843769, 157326849, 215384976, 245893761, 254817369, 326597184, 361874529, 375468129, 382945761, 385297641, 412739856, 523814769, 529874361, 537219684, 549386721, 587432169, 589324176, 597362481, 615387249
Offset: 1

Views

Author

Luca Onnis and Marco Ripà, Mar 12 2022

Keywords

Comments

Conjecture: there are infinitely many terms.

References

  • John D. Dixon and Brian Mortimer, Permutation groups. Graduate Texts in Mathematics, 163. Springer-Verlag, New York, 1996. xii+346 pp. ISBN: 0-387-94599-7 MR1409812 (98m:20003).

Crossrefs

Programs

  • Python
    from itertools import permutations
    def pmap(s, m): return sum(s[i-1]*10**(m-i) for i in range(1, len(s)+1))
    def agen():
      m = 1
      while True:
        for s in permutations(range(1, m+1)): yield pmap(s, m)
        m += 1
    def aupton(terms):
      alst, g = [], agen()
      while len(alst) < terms: alst += [next(g)]
      return alst
    def is_perfect_square(n):
            return round(n ** 0.5) ** 2 == n
    print([x for x in aupton(5000000) if is_perfect_square(x)])
    
  • Python
    from itertools import count, islice, permutations
    from sympy import integer_nthroot
    def A352329_gen(): # generator of terms
        for l in count(1):
            if (r := l*(l+1)//2 % 9) == 0 or r == 1 or r == 4 or r == 7:
                m = tuple(10**(l-i-1) for i in range(l))
                for p in permutations(range(1,l+1)):
                    if integer_nthroot(n := sum(prod(k) for k in zip(m,p)),2)[1]:
                        yield n
    A352329_list = list(islice(A352329_gen(),10)) # Chai Wah Wu, Mar 21-22 2022

A237450 Triangle read by rows, T(n,k) = !n + (k-1)*(n-1)!, with n>=1, 1<=k<=n; Position of the first n-letter permutation beginning with number k in the list of lexicographically sorted permutations A030299.

Original entry on oeis.org

1, 2, 3, 4, 6, 8, 10, 16, 22, 28, 34, 58, 82, 106, 130, 154, 274, 394, 514, 634, 754, 874, 1594, 2314, 3034, 3754, 4474, 5194, 5914, 10954, 15994, 21034, 26074, 31114, 36154, 41194, 46234, 86554, 126874, 167194, 207514, 247834, 288154, 328474, 368794, 409114, 771994, 1134874, 1497754, 1860634, 2223514, 2586394, 2949274, 3312154, 3675034
Offset: 1

Views

Author

Antti Karttunen, Feb 08 2014

Keywords

Comments

When organized as a triangular table
1;
2, 3;
4, 6, 8;
10, 16, 22, 28;
34, 58, 82, 106, 130;
...
the k-th term of row n gives the position of the first n-letter permutation beginning with number k among all the lexicographically ordered permutations A030299. Thus the terms give the positions of rows of irregular table A237265 among the rows of A030298.
Note: the notation !n stands for the left factorial, A003422(n).

Crossrefs

Programs

  • Mathematica
    lf[n_] := lf[n] = (-1)^n n! Subfactorial[-n - 1] - Subfactorial[-1] // FullSimplify;
    T[n_, k_] := lf[n] + (k - 1)(n - 1)!;
    Table[T[n, k], {n, 1, 10}, {k, 1, n}] // Flatten
  • Scheme
    (define (A237450 n) (+ (A003422 (A002024 n)) (* (A002262 (- n 1)) (A000142 (- (A002024 n) 1)))))

Formula

a(n) = A003422(A002024(n)) + (A002262(n-1)*A000142(A002024(n)-1)).

A055089 List of all finite permutations in reversed colexicographic ordering.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Apr 18 2000

Keywords

Examples

			In this table, each row consists of A001563(n) permutations of n+1 terms; i.e., we have (1/) 2,1/ 1,3,2; 3,1,2; 2,3,1; 3,2,1/ 1,2,4,3; 2,1,4,3; ... .
Append to each an infinite number of fixed terms and we get a list of rearrangements of the natural numbers, but with only a finite number of terms permuted:
1/2,3,4,5,6,7,8,9,...
2,1/3,4,5,6,7,8,9,...
1,3,2/4,5,6,7,8,9,...
3,1,2/4,5,6,7,8,9,...
2,3,1/4,5,6,7,8,9,...
3,2,1/4,5,6,7,8,9,...
1,2,4,3/5,6,7,8,9,...
2,1,4,3/5,6,7,8,9,...
Alternatively, if we take only the first n terms of each such infinite row, then the first n! rows give all permutations of the elements 1,2,...,n.
		

Crossrefs

Inversion vectors: A007623, cycle counts: A055090, minimum number of transpositions: A055091, minimum number of adjacent transpositions: A034968, order of each permutation: A055092, number of non-fixed elements: A055093, positions of inverses: A056019, positions after Foata transform: A065181; positions of fixed-point-free involutions: A064640.
Cf. A195663, array of the infinite rows.
This permutation list gives essentially the same information as A030298/A030299, but in a more compact way, by skipping those permutations of A030298 that start with a fixed element.
A220658(n) gives the rank r of the permutation of which the term at a(n) is an element.
A220659(n) gives the zero-based position (from the left) of that a(n) in that permutation of rank r.
A084558(r)+1 gives the size of the finite subsequence (of the r-th infinite, but finitary permutation) which has been included in this list.

Programs

  • Maple
    factorial_base := proc(nn) local n,a,d,j,f; n := nn; if(0 = n) then RETURN([0]); fi; a := []; f := 1; j := 2; while(n > 0) do d := floor(`mod`(n,(j*f))/f); a := [d,op(a)]; n := n - (d*f); f := j*f; j := j+1; od; RETURN(a); end;
    fexlist2permlist := proc(a) local n,b,j; n := nops(a); if(0 = n) then RETURN([1]); fi; b := fexlist2permlist(cdr(a)); for j from 1 to n do if(b[j] >= ((n+1)-a[1])) then b[j] := b[j]+1; fi; od; RETURN([op(b),(n+1)-a[1]]); end;
    fac_base := n -> fac_base_aux(n,2); fac_base_aux := proc(n,i) if(0 = n) then RETURN([]); else RETURN([op(fac_base_aux(floor(n/i),i+1)), (n mod i)]); fi; end;
    PermRevLexUnrank := n -> `if`((0 = n),[1],fexlist2permlist(fac_base(n)));
    cdr := proc(l) if 0 = nops(l) then ([]) else (l[2..nops(l)]); fi; end; # "the tail of the list"
    # Same algorithm in different guise, showing how permutations are composed of adjacent transpositions (compare to algorithm PermUnrank3R at A060117):
    PermRevLexUnrankAMSDaux := proc(n,r, pp) local s,p,k; p := pp; if(0 = r) then RETURN(p); else s := floor(r/((n-1)!)); for k from n-s to n-1 do p := permul(p,[[k,k+1]]); od; RETURN(PermRevLexUnrankAMSDaux(n-1, r-(s*((n-1)!)), p)); fi; end;
    PermRevLexUnrankAMSD := proc(r) local n; n := nops(factorial_base(r)); convert(PermRevLexUnrankAMSDaux(n+1,r,[]),'permlist',1+(((r+2) mod (r+1))*n)); end;
  • Mathematica
    A055089L[n_] := Reverse@SortBy[DeleteCases[Permutations@Range@n, {, n}], Reverse]; Flatten@Array[A055089L, 4] (* JungHwan Min, Aug 28 2016 *)

Formula

[seq(op(PermRevLexUnrank(j)), j=0..)]; (see Maple code given below).

Extensions

Name changed by Tilman Piesk, Feb 01 2012

A030298 List of permutations of 1,2,3,...,n for n=1,2,3,..., in lexicographic order.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Contains every finite sequence of distinct numbers, infinitely many times.

Examples

			The permutations can be written as
  1,
  12, 21,
  123, 132, 213, 231, 312, 321, etc.
Write them in order and insert commas.
		

Crossrefs

A030299 gives the initial portion of these same permutations as decimally encoded numbers.
Cf. A001563 (row lengths), A001286 (row sums).
Cf. A030496 for another ordering.
The same information is essentially given in A055089, but in more compact way, by skipping those permutations which start with a fixed element (cf. A220696).
A220660(n) tells the zero-based rank r of the n-th permutation in this sequence, among all finite permutations of the same size.
A220663(n) tells the zero-based position (from the left) of that a(n) in that permutation of rank r.
A084557(n) tells that the n-th term a(n) belongs to the a(n):th lexicographically ordered permutation from the start (its "global rank").
A220660(A084557(n)) tells the "local rank" of the permutation (amongst the permutations of the same size) to which the n-th term a(n) belongs.
(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.

Programs

  • Haskell
    import Data.List (permutations, sort)
    a030298 n k = a030298_tabf !! (n-1) (k-1)
    a030298_row = concat . sort . permutations . enumFromTo 1
    a030298_tabf = map a030298_row [1..]
    -- Reinhard Zumkeller, Mar 29 2012
    (MIT/GNU Scheme, with Antti Karttunen's intseq-library):
    ;; Note that in Scheme, vector indexing is zero-based.
    ;; Requires also A055089permvec from A055089.
    (define (A030298 n) (vector-ref (A030298permvec (A084556 (A084557 n)) (A220660 (A084557 n))) (A220663 n)))
    (define (A030298permvec size rank) (vector-reverse (vector1invert (A055089permvec size rank))))
    (define (vector1invert vec) (make-initialized-vector (vector-length vec) (lambda (i) (1+ (- (vector-length vec) (vector-ref vec i))))))
    (define (vector-reverse vec) (make-initialized-vector (vector-length vec) (lambda (i) (vector-ref vec (- (vector-length vec) i 1)))))
    
  • Mathematica
    f[n_] := Permutations[Range@ n, {n}]; Array[f, 4] // Flatten (* Robert G. Wilson v, Dec 18 2012 *)
  • Python
    from itertools import permutations, count, chain, islice
    def A030298_gen(): # generator of terms
        return chain.from_iterable(p for l in count(2) for p in permutations(range(1,l)))
    A030298_list = list(islice(A030298_gen(),30)) # Chai Wah Wu, Mar 21 2022

Formula

Start with 1, then 12 and 21, then the 6 permutations of 123 in lexical order: 123, 132, 213, 231, 312, 321 and so on.

Extensions

Entry revised by N. J. A. Sloane, Feb 02 2006
Keyword tabf added by Reinhard Zumkeller, Mar 29 2012

A170942 Take the permutations of lengths 1, 2, 3, ... arranged lexicographically, and replace each permutation with the number of its fixed points.

Original entry on oeis.org

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

Views

Author

Neven Juric (neven.juric(AT)apis-it.hr) and N. J. A. Sloane, Feb 23 2010

Keywords

Comments

Length of n-th row = sum of n-th row = n!; number of zeros in n-th row = A000166(n); number of positive terms in n-th row = A002467(n). [Reinhard Zumkeller, Mar 29 2012]

Examples

			123,132,213,231,312,321 (corresponding to 3rd row of triangle A030298) have respectively 3,1,1,0,0,1 fixed points.
		

Crossrefs

Programs

  • Haskell
    import Data.List (permutations, sort)
    a170942 n k = a170942_tabf !! (n-1) (k-1)
    a170942_row n = map fps $ sort $ permutations [1..n] where
       fps perm = sum $ map fromEnum $ zipWith (==) perm [1..n]
    a170942_tabf = map a170942_row [1..]
    -- Reinhard Zumkeller, Mar 29 2012

Extensions

a(36)-a(105) from John W. Layman, Feb 23 2010
Keyword tabf added by Reinhard Zumkeller, Mar 29 2012

A240763 Preferential arrangements of 1, 2, 3, ... things in one-line notation, arranged lexicographically.

Original entry on oeis.org

1, 11, 12, 21, 111, 112, 121, 122, 123, 132, 211, 212, 213, 221, 231, 312, 321, 1111, 1112, 1121, 1122, 1123, 1132, 1211, 1212, 1213, 1221, 1222, 1223, 1231, 1232, 1233, 1234, 1243, 1312, 1321, 1322, 1323, 1324, 1332, 1342, 1423, 1432, 2111, 2112, 2113, 2121, 2122, 2123, 2131, 2132, 2133, 2134, 2143, 2211, 2212
Offset: 1

Views

Author

N. J. A. Sloane, Apr 12 2014

Keywords

Comments

A preferential arrangement is like a permutation, except that ties are allowed. Preferential arrangements are also called ordered partitions. See A000670.
There are A000670(n) terms of length n.

Examples

			The preferential arrangement of 7 things given by
3=4 < 5 < 1=2=7 < 6
would be represented by
1 2 3 4 5 6 7
3 3 1 1 2 4 3
which in the compressed one-line notation is written 3311243. Obviously this compressed notation only works for fewer than 10 things. In the "human-readable" notation used in the a-file, this example would be written 34,5,127,6.
Thanks to _Nathaniel Shar_ for suggesting the one-line notation.
		

Crossrefs

Cf. A000670, A239914, A217389, A030299 (an analogous sequence for permutations).

A217626 First differences of A215940, or first differences of permutations of (0,1,2,...,m-1) reading them as decimal numbers, divided by 9 (with 10>=m, and m! > n).

Original entry on oeis.org

1, 9, 2, 9, 1, 78, 1, 19, 3, 8, 2, 77, 2, 8, 3, 19, 1, 78, 1, 9, 2, 9, 1, 657, 1, 9, 2, 9, 1, 178, 1, 29, 4, 7, 3, 66, 2, 18, 4, 18, 2, 67, 1, 19, 3, 8, 2, 646, 1, 19, 3, 8, 2, 67, 1, 29, 4, 7, 3, 176, 3, 7, 4, 29, 1, 67, 2, 8, 3, 19, 1, 646, 2, 8, 3, 19, 1
Offset: 1

Views

Author

R. J. Cano, Oct 04 2012

Keywords

Comments

Terms do not depend on the choice of m, provided that m!>n (the index of the considered term), and the numbers associated to a permutation s of {0,...,m-1} are N(s) = Sum_{i=1..m} s(i)*10^(m-i). This defines the present sequence for any arbitrarily large index, not limited to n <= 10!, for example.
Similar sequences might be built in another base b, they would always start (1, b-1, 2, b-1, 1, ...). The partial sums of this kind of sequence would yield the analog of A215940 in the corresponding base.
There are at least two palindromic patterns which are repeated throughout this sequence: one of them is "1,b-1,2,b-1,1" (It is optional here whether or not to include the 1's), another is built from the first 4!-1 terms (See the corresponding link for details).
Also, for 1<=n<=(9!)-1: The repeating parts in the first differences of A030299 divided by nine, i.e. a(n) = A219664(n)/9. - Antti Karttunen, Dec 18 2012. Edited by: R. J. Cano, May 09 2017
There are more palindromic patterns than those mentioned above: Similar to the first 3!-1 and the first 4!-1 terms, the first k!-1 terms are repeated for all other k>4. Frequent are also multiples of these, e.g., k*[1,9,2,9,1] = [2,18,4,18,2], [3,27,6,27,3], ...), [1, 19, 3, 8, 2, 67, 1, 29, 4, 7, 3, 176, 3, 7, 4, 29, 1, 67, 2, 8, 3, 19, 1], and others. The "middle part" of roughly half the length (e.g., [9,2,9] or [67,...,67] in the last example), is repeated even more frequently. - M. F. Hasler, Jan 14 2013
From R. J. Cano, Apr 04 2016: (Start)
Conjecture 1: Given 1A217626 and so on).
Lemma: Let P be an arbitrary set consisting of m integers; let x[i] be an element in P (with 1<=i<=m); let y[j] = x[j+1] - x[j] (with 1 <= j <= m-1) be the 1st differences of P. These differences are symmetric if y[j]=y[m-j] which for P implies the condition x[j]+x[m-j+1]=x[j+1]+x[m-j];
Consequence: When m=n! and P is a set with all the permutations for the letters 0..n-1, the preceding lemma implies P has associated at least a set Q such that 1st differences in Q are symmetric.
Generating algorithm: Such Q can be built based upon P and the condition given by the preceding lemma if it is removed from P (until P becomes empty) its 1st element tau, inserting them both in Q tau and its arithmetic complement to repdigit (n-1)*111...1 (n times 1) removing the mentioned complement from P.
Conjecture 2: The autosimilarity shown by a(n) is a consequence of the fact that the corresponding P is the set of the n! permutations in increasing sequence for the letters 0..n-1, and Q=P (it holds if they are replaced "a(n)" and "increasing" respectively with "-1*a(n)" and "decreasing").
Note: "Q=P" is a necessary but not sufficient condition for observing the autosimilarity in a(n).
Application: The "generating algorithm" described previously might be potentially useful for parallel computing. In combination with the partition scheme proposed at links in A237265, and multiple indirection. For example notice that in such sense an algorithm for generating k! permutations with an increasing sequence would require only k!/2 iterations because the other half would be already determined by symmetry.
Conjecture 3: For n>2, given P the set of permutations in increasing sequence for the letters 0..n-1, there are distributed with a symmetric pattern among its (n!)! permutations all those A000165(n!\2) of them such that their 1st differences are symmetric. Moreover by setting to zero the other elements whose 1st differences are not symmetric, we obtain an antisymmetric sequence.
(End)
Conjecture 4: If 2<=mR. J. Cano, Apr 19 2017
Consider the first y!-1 terms for even y; The central term a(y!/2) is determined by the difference between the (y/2+1)th row from the y-th matrix defining the irregular table in A237265 and the consecutive permutation preceding it in lexicographic order (See EXAMPLE). - R. J. Cano, May 09 2017

Examples

			a(1)= A215940(2) - A215940(1) = 1 - 0 = 1.
a(2)= A215940(3) - A215940(2) = 10-01 = 9.
a(3)= A215940(4) - A215940(3) = 12-10 = 2.
a(4)= A215940(5) - A215940(4) = 21-12 = 9.
a(5)= A215940(6) - A215940(5) = 22-21 = 1.
From _R. J. Cano_, May 09 2017: (Start)
On the central terms for subsequences consisting of the first y!-1 terms with even y: Let us pick y=4; The first y!-1=23 terms are: (1,9,2,9,1,78,1,19,3,8,2,77,2,8,3,19,1,78,1,9,2,9,1) the central term there is a(12)=77.
If we look into A237265, the 4th matrix defining it contains as its (4/2+1)th or third row, the permutation 3124 which in lexicographic order is preceded by 2431, therefore by subtracting and dividing by 9 we obtain: (3124-2431)/9 = 693/9 = (2013-1320)/9 = 77 = a(12). (End)
		

Crossrefs

Cf. A219995 [ On the summation of 1/a(n) ].

Programs

  • C
    // See LINKS.
    
  • Maple
    A217626:=n->A215940(n+1)-A215940(n);
  • Mathematica
    maxm = 5; Table[dd = FromDigits /@ Permutations[Range[m]]; (Drop[dd, If[m == 1, 0, (m - 1)!]] - First[dd])/9, {m, 1, maxm}] // Flatten // Differences (* Jean-François Alcover, Apr 25 2013 *)
  • PARI
    first_terms(n)={n=max(3,n);my(m:small=n!);my(a:vec=vector(m-1),i:small=0,x:vec=numtoperm(n,0),y:vec,z:vec,u:small,B:small=11);m\=2;m--;while(i++<=m,u=!(i%6);y=numtoperm(n,i);z=(y-x)[1..n-1];if(u,z=vector(#z,j,vecsum(z[1..j])));a[i]=fromdigits(z,B-u);a[#a-i+1]=a[i];x=y;);z=(numtoperm(n,m+1)-y)[1..n-1];a[m+1]=fromdigits(vector(#z,j,vecsum(z[1..j])),B--);return(a)} \\ Computes the first either 5 or n!-1 terms. - R. J. Cano, May 28 2017
  • Scheme
    (define (A217626 n) (/ (A219664 n) 9)) ;; - Antti Karttunen, Dec 18 2012
    

Formula

a(n) = A215940(n+1) - A215940(n).
a(n) = A219664(n)/9, for n=1..362879. - Antti Karttunen, Dec 18 2012
a(n) = A209280(n)/9, for n < 9!. - M. F. Hasler, Jan 12 2013

Extensions

Definition simplified by M. F. Hasler, Jan 12 2013

A219664 Repeating part of A220664: First differences of the numbers given as concatenation of permutations of (1,...,m) for sufficiently large m.

Original entry on oeis.org

9, 81, 18, 81, 9, 702, 9, 171, 27, 72, 18, 693, 18, 72, 27, 171, 9, 702, 9, 81, 18, 81, 9, 5913, 9, 81, 18, 81, 9, 1602, 9, 261, 36, 63, 27, 594, 18, 162, 36, 162, 18, 603, 9, 171, 27, 72, 18, 5814, 9, 171, 27, 72, 18, 603, 9, 261, 36, 63, 27, 1584, 27, 63, 36
Offset: 1

Views

Author

Antti Karttunen, Dec 18 2012

Keywords

Comments

First 5!-1 terms are identical to A107346, and the 9!-1 terms are identical to A209280. (Updated by M. F. Hasler, Jan 12 2013, Mar 03 2013)
Because of the self-similar nature of A220664, this sequence can be also constructed by picking appropriate terms from there with the auxiliary sequence A220655, cf. formula.
Similarly, differences between successive permutations of {1,2,...,k} in lexicographic order interpreted as decimal numbers, for any k=2..9, produce the first (k!)-1 terms of this sequence. But for k=10 the result is ill-defined, so we can consider the sequence finite, well-defined only for n=1..362879. [See however the following comment. - Editor's note]
In sequence A030299 it is clearly defined how it extends beyond index n = 1!+2!+...+9! = A007489(9), so the sequence A220664 of its first differences is well-defined up to infinity. (The "result" mentioned above is ill defined because the meaning of "interpreted" is not clear.) But the preceding comment is misleading by speaking of "self similar nature", and the sequence definition as "repeating part" is also misleading: If the sequence is defined to be of finite length 9!-1 (thus equal to A209280), then it is indeed infinitely often repeated as a subsequence (of consecutive terms) in A220664 (even when the latter was defined using concatenation for permutations of more than 9 elements, but then not as differences of the terms following 12345678910 where it was expected, but, e.g., as differences of the terms following 10123456789, etc.).
Since A030299 has been defined through a ("simpler") sum rather than concatenation, the nice mathematical properties of A220664, and even more this sequence A219664, persist beyond n=9!. - M. F. Hasler, Jan 12 2013

Examples

			The first four permutations of nine elements at A030299(A003422(9)..A003422(9)+3) (the terms A030299(46234..46237)) are: 123456789, 123456798, 123456879, 123456897. As 123456897-123456879 = 18, thus we have a(3) = 18.
We could compute the same value from any smaller set of permutations of at least three elements, for example, from the five element permutations used in A107346. In that case, the permutations A030299(A003422(5)..A003422(5)+3) (the terms A030299(34..37)) are: 12345, 12354, 12435, 12453, ... and we get the same result, a(3) = 12453-12435 = 18.
		

Crossrefs

Programs

  • PARI
    A219664(n)=for(k=2,n+1, k!>n || next; k=vecsort( vector( (#k=vector(k,j,10^j)~\10)!,i,numtoperm(#k,i)*k )); return(k[n+1]-k[n]))  \\ (It is of course more efficient to calculate a whole vector of the first k!-1 terms. Also, for n>9!, this might yield incorrect terms.) - M. F. Hasler, Jan 12 2013
  • Scheme
    (define (A219664 n) (A220664 (A220655 n)))
    

Formula

a(n) = A220664(A220655(n)).
a(n) = 9*A217626(n).

A209280 First difference of A050289 = numbers whose digits are a permutation of (1,...,9).

Original entry on oeis.org

9, 81, 18, 81, 9, 702, 9, 171, 27, 72, 18, 693, 18, 72, 27, 171, 9, 702, 9, 81, 18, 81, 9, 5913, 9, 81, 18, 81, 9, 1602, 9, 261, 36, 63, 27, 594, 18, 162, 36, 162, 18, 603, 9, 171, 27, 72, 18, 5814, 9, 171, 27, 72, 18, 603, 9, 261, 36, 63, 27, 1584, 27, 63, 36, 261, 9
Offset: 1

Views

Author

M. F. Hasler, Jan 12 2013

Keywords

Comments

This sequence is the natural extension of A107346 (and others, see below) from 5!-1 to 9!-1 terms, which is the natural (since maximal) length, given that OEIS sequence data are stored as decimal numbers. On the other hand, it is quite different from A219664 in many aspects, not only for the reason that the other sequence is infinite and therefore differs from this one in all terms beyond n = 9!-1.
The sequence is finite, with 9!-1 terms, and symmetric: a(n)=a(9!-n).
All terms are multiples of 9, cf. formula.
The subsequence of the first n!-1 terms (n=2,...,9) yields the first differences of the sequence of numbers whose digits are a permutation of (1,...,n):
The first 8!-1 terms yield the first differences of A178478: numbers whose digits are a permutation of 12345678.
The first 7!-1 terms yield the first differences of A178477: numbers whose digits are a permutation of 1234567.
The first 6!-1 terms yield the first differences of A178476: numbers whose digits are a permutation of 123456.
The first 5!-1 terms yield A107346, the first differences of A178475: numbers whose digits are a permutation of 12345.

Examples

			The same initial terms are obtained for the permutations of any set of the form {1,...,m}, e.g., {1,2,3} or {1,...,9}: In the first case we have P = (123,132,213,231,312,321) and P(4)-P(3) = 231 - 213 = 18 = a(3), and in the latter case P(4)-P(3) = 123456897 - 123456879 = 18, again. - _M. F. Hasler_, Jan 12 2013
		

Crossrefs

Programs

  • Mathematica
    Take[Differences[Sort[FromDigits/@Permutations[Range[9]]]],70] (* Harvey P. Dale, Mar 31 2018 *)
  • PARI
    A209280_list(N=5)={my(v=vector(N,i,10^(N-i))~); v=vecsort(vector(N!,k,numtoperm(N,k)*v)); vecextract(v,"^1")-vecextract(v,"^-1")} \\ return the N!-1 first terms as a vector
    
  • PARI
    A209280(n)={if(a209280=='a209280 || #a209280A209280_list(A090529(n+1)));a209280[n]}

Formula

a(n) = A219664(n) = 9*A217626(n) (for n < 9!). - M. F. Hasler, Jan 12 2013
a(n) = a(m!-n) for any m < 10 such that n < m!.
Showing 1-10 of 33 results. Next