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

A263328 Permutation of {0, ..., 1023} corresponding to lexicographic ordering of numbers with decreasing digits (A009995). Inverse of A263327.

Original entry on oeis.org

0, 1, 2, 11, 3, 12, 13, 56, 4, 14, 15, 57, 16, 58, 59, 176, 5, 17, 18, 60, 19, 61, 62, 177, 20, 63, 64, 178, 65, 179, 180, 386, 6, 21, 22, 66, 23, 67, 68, 181, 24, 69, 70, 182, 71, 183, 184, 387, 25, 72, 73, 185, 74, 186, 187, 388, 75, 188, 189, 389, 190
Offset: 0

Views

Author

Reinhard Zumkeller, Oct 15 2015

Keywords

Comments

For n = 1..1023: A009995(a(n)) = A262557(n).
The fixed points and cycles of this permutation (up to reversal the same as for its inverse A263327) are listed in A263355. - M. F. Hasler, Dec 11 2019

Crossrefs

Cf. A009995, A262557, A263327 (inverse), A263329 (fixed points).

Programs

  • Haskell
    a263328 0 = 0
    a263328 n = head [x | x <- [1..1023], a009995' x == a262557 n]
    
  • PARI
    A263328=vecsort(A263327,,1) \\ Does not include a(0)=0. - M. F. Hasler, Dec 11 2019

A263329 Fixed points of permutations A263327 and A263328.

Original entry on oeis.org

0, 1, 2, 17, 18, 84, 939, 1005, 1006, 1021, 1022, 1023
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 15 2015

Keywords

Comments

a(k) = A263355(k,1) for k such that A263383(k) = 1.

Crossrefs

Programs

  • Haskell
    a263329 n = a263329_list !! (n-1)
    a263329_list = [x | x <- [0..1023], a263327 x == x]

A263355 Table read by rows: cycles of the permutation A263327, sorted in increasing order of their largest element. The elements in each cycle are listed in decreasing numerical order.

Original entry on oeis.org

0, 1, 2, 16, 12, 5, 17, 18, 84, 192, 75, 68, 65, 64, 56, 38, 28, 26, 7, 939, 978, 908, 881, 853, 852, 840, 809, 798, 782, 777, 776, 772, 760, 758, 756, 746, 736, 717, 711, 708, 703, 698, 690, 669, 666, 662, 647, 622, 610, 595, 585, 564, 555, 553, 547, 531
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 16 2015

Keywords

Comments

A263383(n) gives the number of terms in row n.
Fixed points: T(k,m) in A263329 <=> A263383(k) = 1 = m. [Corrected by M. F. Hasler, Dec 11 2019]
The permutations A263327 and its inverse A263328 have 18 cycles, of which 12 are fixed points (listed in A263329), two are 3-cycles (rows 4 and 14 of this table), two are 10-cycles (rows 8 & 13), one is a 74-cycle (row 10) and one is a 912-cycle. - M. F. Hasler, Dec 11 2019
Normally one would list the elements in each cycle in the order in which they appear when the permutation is applied, but that is not the order used here. - N. J. A. Sloane, Dec 11 2019

Examples

			   n | Cycles: A263355(n, k=1..A263383(n))                    | A263383(n)
  ---+--------------------------------------------------------+-----------
   1 | (0)                                                    |       1
   2 | (1)                                                    |       1
   3 | (2)                                                    |       1
   4 | (16, 12, 5)                                            |       3
   5 | (17)                                                   |       1
   6 | (18)                                                   |       1
   7 | (84)                                                   |       1
   8 | (192, 75, 68, 65, 64, 56, 38, 28, 26, 7)               |      10
   9 | (939)                                                  |       1
  10 | (978, 908, 881, 853, 852, 840, ..., 142, 115, 45)      |      74
  11 | (1005)                                                 |       1
  12 | (1006)                                                 |       1
  13 | (1016, 997, 995, 985, 967, 959, 958, 955, 948, 831)    |      10
  14 | (1018, 1011, 1007)                                     |       3
  15 | (1020, 1019, 1017, 1015, 1014, ..., 10, 9, 8, 6, 4, 3) |     912
  16 | (1021)                                                 |       1
  17 | (1022)                                                 |       1
  18 | (1023)                                                 |       1
A263327(5) = 16, A263327(16) = 12, A263327(12) = 5, so (5 16 12) = (16 12 5) is a 3-cycle. For all other cycles of length > 1, the order in which the terms occur under the map (e.g. 1018 -> 1007 -> 1011 -> 1018 for row 14) is different from the decreasing order given above. - _M. F. Hasler_, Dec 11 2019
		

Crossrefs

Cf. A263327, A263383 (row lengths), A263329.

Programs

  • Haskell
    import Data.List ((\\), sort)
    a263355 n k = a263355_tabf !! (n-1) !! (k-1)
    a263355_row n = a263355_tabf !! (n-1)
    a263355_tabf = sort $ cc a263327_list where
       cc [] = []
       cc (x:xs) = (reverse $ sort ys) : cc (xs \\ ys)
          where ys = x : c x
                c z = if y /= x then y : c y else []
                      where y = a263327 z
    
  • PARI
    {M=0; (C(x,L=[x])=until(x==L[1], M+=1<A263327[x]));L); vecsort(vector(18,i,vecsort(C(valuation(M+1,2)),,12)))} \\ append [^15] to remove the long row 15. - M. F. Hasler, Dec 11 2019

Extensions

Edited by M. F. Hasler, Dec 11 2019

A263383 Lengths of cycles of permutation A263327.

Original entry on oeis.org

1, 1, 1, 3, 1, 1, 1, 10, 1, 74, 1, 1, 10, 3, 912, 1, 1, 1
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 16 2015

Keywords

Comments

Cycle type of permutation A263327 = (1^12, 3^2, 10^2, 74, 912);
A263355(k,1) = A263329(k) for k such that a(k) = 1.
row lengths of A263355;
number of terms = 18; sum of terms = 1024.

Examples

			See A263355.
		

Crossrefs

Programs

  • Haskell
    a263383 = length . a263355_row

A009995 Numbers with digits in strictly decreasing order. From the Macaulay expansion of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 21, 30, 31, 32, 40, 41, 42, 43, 50, 51, 52, 53, 54, 60, 61, 62, 63, 64, 65, 70, 71, 72, 73, 74, 75, 76, 80, 81, 82, 83, 84, 85, 86, 87, 90, 91, 92, 93, 94, 95, 96, 97, 98, 210, 310, 320, 321, 410, 420, 421, 430, 431, 432, 510, 520, 521, 530
Offset: 1

Views

Author

Keywords

Comments

There are precisely 1023 terms (corresponding to every nonempty subset of {0..9}).
A178788(a(n)) = 1. - Reinhard Zumkeller, Jun 30 2010
A193581(a(n)) > 0 for n > 9. - Reinhard Zumkeller, Aug 10 2011
A227362(a(n)) = a(n). - Reinhard Zumkeller, Jul 09 2013
For a fixed natural number r, any natural number n has a unique "Macaulay expansion" n = C(a_r,r)+C(a_{r-1},r-1)+...+C(a_1,1) with a_r > a_{r-1} > ... > a_1 >= 0. If r=10, concatenating the digits a_r, ..., a_1 gives the present sequence. The representation is valid for all n, but the concatenation only makes sense if all the a_i are < 10. - N. J. A. Sloane, Apr 05 2014
a(n) = A262557(A263327(n)); a(A263328(n)) = A262557(n). - Reinhard Zumkeller, Oct 15 2015

Crossrefs

Cf. A009993.
Cf. A262557 (sorted lexicographically), A263327, A263328.

Programs

  • Haskell
    import Data.Set (fromList, minView, insert)
    a009995 n = a009995_list !! n
    a009995_list = 0 : f (fromList [1..9]) where
       f s = case minView s of
             Nothing     -> []
             Just (m,s') -> m : f (foldl (flip insert) s' $
                                  map (10*m +) [0..m `mod` 10 - 1])
    -- Reinhard Zumkeller, Aug 10 2011
    
  • Mathematica
    Sort@ Flatten@ Table[FromDigits /@ Subsets[ Range[9, 0, -1], {n}], {n, 10}] (* Zak Seidov, May 10 2006 *)
  • PARI
    is(n)=fromdigits(vecsort(digits(n),,12))==n \\ Charles R Greathouse IV, Apr 16 2015

A294648 Irregular triangle read by rows, representing a family of sequences L(n), for n=1, 2, 3, ... The sequence L(n) (i.e., the n-th row) is the ordinance of vectors of the n-dimensional Boolean cube (hypercube) {0,1}^n in accordance with their (Hamming) weights, where the lexicographic order is chosen as a second criterion for an ordinance the vectors of equal weights.

Original entry on oeis.org

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

Views

Author

Valentin Bakoev, Nov 06 2017

Keywords

Comments

The sequences represent the ordinance of vectors of the n-dimensional Boolean cube (hypercube) {0,1}^n in accordance with their (Hamming) weights. The lexicographic order is chosen as a second criterion for the ordinance of the vectors of equal weights. We refer to this order as a Weight-Lexicographic Order (WLO). The WLO is represented by the (serial) numbers of the vectors, instead of the vectors itself. It is well known that if the vectors of {0,1}^n are in lexicographic (standard) order, their numbers form the sequence of natural numbers 0, 1, 2, ..., 2^n-1. So, the WLO means a permutation of the numbers 0, 1, 2, ..., 2^n-1, such that the corresponding vectors are in WLO. This sequence (permutation) is denoted by L(n). It consists of (n+1) subsequences, corresponding to the layers of the Boolean cube.

Examples

			The lexicographic order of {0,1}^3 is: (0,0,0), (0,0,1), (0,1,0), (0,1,1), (1,0,0), (1,0,1), (1,1,0), (1,1,1), and the corresponding sequence of (serial) numbers is: 0, 1, 2, ..., 7. The WLO of these vectors is given by the sequence L(3)= 0, 1, 2, 4, 3, 5, 6, 7.
The triangle starts:
n=1: 0, 1;
n=2: 0, 1, 2, 3;
n=3: 0, 1, 2, 4, 3, 5, 6, 7;
n=4: 0, 1, 2, 4, 8, 3, 5, 6, 9, 10, 12, 7, 11, 13, 14, 15;
n=5: 0, 1, 2, 4, 8, 16, 3, 5, 6, 9, 10, 12, 17, 18, 20, 24, 7, 11, 13, 14, 19, 21, 22, 25, 26, 28, 15, 23, 27, 29, 30, 31;
n=6: 0, 1, 2, 4, 8, 16, 32, 3, 5, 6, 9, 10, 12, 17, 18, 20, 24, 33, 34, 36, 40, 48, 7, 11, 13, 14, 19, 21, 22, 25, 26, 28, 35, 37, 38, 41, 42, 44, 49, 50, 52, 56, 15, 23, 27, 29, 30, 39, 43, 45, 46, 51, 53, 54, 57, 58, 60, 31, 47, 55, 59, 61, 62, 63;
		

Crossrefs

A051459 gives the orders' number of the vectors of {0,1}^n in accordance with their weights.
Cf. A007318, A047869 (8th row), A091444 (as bits), A187769, A263327 (10th row).
Cf. A382467.

Programs

  • Maple
    with(ListTools): conc := (a,b,c) -> Flatten([op(a),[seq(op(j)+c, j in b)]], 1):
    rec := proc(n,k) option remember; `if`(k=0, [0], `if`(k=n, [2^n-1], conc(rec(n-1,k), rec(n-1,k-1), 2^(n-1)))) end:
    L := n -> `if`(n=1, [0,1], Flatten([seq(rec(n,k),k=0..n)], 1)):
    Flatten([seq(L(n), n = 1..6)], 1); # Peter Luschny, Nov 06 2017
  • Mathematica
    conc[a_List, b_List, c_] := Join[a, b + c];
    rec[n_, k_] := rec[n, k] = If[k == 0, {0}, If[k == n, {2^n - 1}, conc[rec[n - 1, k], rec[n - 1, k - 1], 2^(n - 1)]]];
    L[n_] := If[n == 1, {0, 1}, Flatten[Table[rec[n, k], {k, 0, n}]]];
    Array[L, 6] // Flatten (* Jean-François Alcover, Jul 26 2018, after Peter Luschny *)
    Table[SortBy[Range[0, 2^n - 1], DigitSum[#, 2] &], {n, 6}] (* Paolo Xausa, Jul 28 2025 *)
  • PARI
    cmph(x, y) = my(d=hammingweight(x)-hammingweight(y)); if (d, d, x-y);
    row(n) = my(v=[0..2^n-1]); vecsort(v, cmph); \\ Michel Marcus, Sep 16 2023
  • Python
    from itertools import product
    def sortby(x): return (len(x), x.count('1'), x)
    def agen(maxbindigs):
        for i in range(1, maxbindigs+1):
            for t in sorted([p for p in product("01", repeat=i)], key=sortby):
                yield int("".join(t), 2)
    print([an for an in agen(6)]) # Michael S. Branicky, Aug 13 2021
    

Formula

For n=1, 2, 3, ..., L(n) is defined by the recurrence:
if n=1, L(1)= 0, 1;
else L(n)= l(n, 0), l(n, 1), ..., l(n, k), ..., l(n, n), where the subsequences are defined as follows:
l(n, k)= 0, if k=0, else
l(n, k)= 2^n - 1, if k=n, else
l(n, k)= l(n-1, k), l(n-1, k-1) + 2^{n-1}, for 0 < k < n.
Comments:
1) l(n, k)= l(n-1, k), l(n-1, k-1) + 2^{n-1} means that l(n, k) is a concatenation of two subsequences: l(n-1, k) and l(n-1, k-1) + 2^{n-1}. The second one is obtained after addition of the number 2^{n-1} to each member of l(n-1,k-1).
2) The computing of the members of L(n) resembles the computing (and filling in) the binomial coefficients in Pascal's triangle. The binomial coefficients determine the lengths of the subsequences l(n, k), 0 <= k <= n, in L(n). Thus the beginning of each subsequence can be computed easily.
3) The inductive formula, corresponding to the recurrence, is much more useful for implementations.

A262557 Numbers with digits in strictly decreasing order, sorted lexicographically.

Original entry on oeis.org

0, 1, 10, 2, 20, 21, 210, 3, 30, 31, 310, 32, 320, 321, 3210, 4, 40, 41, 410, 42, 420, 421, 4210, 43, 430, 431, 4310, 432, 4320, 4321, 43210, 5, 50, 51, 510, 52, 520, 521, 5210, 53, 530, 531, 5310, 532, 5320, 5321, 53210, 54, 540, 541, 5410, 542, 5420, 5421
Offset: 1

Views

Author

N. J. A. Sloane, Oct 14 2015

Keywords

Comments

Original name: "Countdown sequences, allowing gaps."
Only digits 0 through 9 are used. The last term is 9876543210.
Equals A009995, sorted lexicographically. - Reinhard Zumkeller, Oct 14 2015
There are 2^k terms starting with digit k >= 0, they start at index 2^k. The countdown sequences, i.e., digits of the n-th term, are given in rows of A272011. - M. F. Hasler, Dec 11 2019

References

  • Donald S. McDonald, Email message to N. J. A. Sloane, Oct 14 2015.

Crossrefs

Programs

  • Haskell
    a262557 n = a262557_list !! (n-1)
    a262557_list = 0 : f [[0]] where
       f xss = if x < 9 then (map (read . concatMap show) zss) ++ f zss else []
               where zss = (map (z :) $ map tail xss) ++ (map (z :) xss)
                     z = x + 1; x = head $ head xss
    -- Reinhard Zumkeller, Oct 14 2015
    
  • Mathematica
    A262557[n_] := FromDigits[BitLength[n] - Flatten[Position[IntegerDigits[n, 2], 1]]]; Array[A262557, 100] (* or *)
    A262557full = Rest[Map[FromDigits, LexicographicSort[Subsets[Range[9, 0, -1]]]]] (*  Paolo Xausa, Feb 13 2024 *)
  • PARI
    is_A262557 = is_A009995
    apply( A262557(n)=fromdigits(Vecrev(vecextract([0..exponent(n+!n)],n))), [1..99])
    # A262557=concat(apply(x(i)=concat(vector(i%10+1,j,if(j>1,x(i*10+j-2),i))),[0..9])) \\ M. F. Hasler, Dec 11 2019
    
  • Python
    from itertools import combinations
    afull = list(map(int, sorted("".join(c) for i in range(1, 11) for c in combinations("9876543210", i)))) # Michael S. Branicky, Feb 13 2024

Formula

a(n) = A009995(A263328(n)); a(A263327(n)) = A009995(n). - Reinhard Zumkeller, Oct 15 2015

Extensions

New name from M. F. Hasler, Dec 11 2019
Showing 1-7 of 7 results.