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 11-20 of 23 results. Next

A319724 Write n in 7-ary, sort digits into decreasing order.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 15, 22, 29, 36, 43, 14, 15, 16, 23, 30, 37, 44, 21, 22, 23, 24, 31, 38, 45, 28, 29, 30, 31, 32, 39, 46, 35, 36, 37, 38, 39, 40, 47, 42, 43, 44, 45, 46, 47, 48, 49, 56, 105, 154, 203, 252, 301, 56, 57, 106, 155, 204, 253, 302, 105, 106, 113, 162
Offset: 0

Views

Author

Seiichi Manyama, Sep 26 2018

Keywords

Crossrefs

b-ary: A073138 (b=2), A319651 (b=3), A319720 (b=4), A319722 (b=5), A319723 (b=6), this sequence (b=7), A319725 (b=8), A319726 (b=9), A004186 (b=10).

Programs

  • Mathematica
    Table[FromDigits[ReverseSort[IntegerDigits[n, 7]], 7], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n, 7), , 4), 7); \\ Michel Marcus, Sep 26 2018
  • Ruby
    def A(k, n)
      (0..n).map{|i| i.to_s(k).split('').sort.reverse.join.to_i(k)}
    end
    p A(7, 100)
    

Formula

n <= a(n) < 7n. - Charles R Greathouse IV, Aug 07 2024

A319726 Write n in 9-ary, sort digits into decreasing order.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 19, 28, 37, 46, 55, 64, 73, 18, 19, 20, 29, 38, 47, 56, 65, 74, 27, 28, 29, 30, 39, 48, 57, 66, 75, 36, 37, 38, 39, 40, 49, 58, 67, 76, 45, 46, 47, 48, 49, 50, 59, 68, 77, 54, 55, 56, 57, 58, 59, 60, 69, 78, 63, 64, 65, 66, 67, 68, 69
Offset: 0

Views

Author

Seiichi Manyama, Sep 26 2018

Keywords

Crossrefs

b-ary: A073138 (b=2), A319651 (b=3), A319720 (b=4), A319722 (b=5), A319723 (b=6), A319724 (b=7), A319725 (b=8), this sequence (b=9), A004186 (b=10).

Programs

  • Mathematica
    Table[FromDigits[Reverse[Sort[IntegerDigits[n,9]]],9],{n,0,70}] (* Harvey P. Dale, Oct 26 2022 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n, 9), , 4), 9); \\ Michel Marcus, Sep 26 2018
  • Ruby
    def A(k, n)
      (0..n).map{|i| i.to_s(k).split('').sort.reverse.join.to_i(k)}
    end
    p A(9, 100)
    

Formula

n <= a(n) < 9n. - Charles R Greathouse IV, Aug 07 2024

A073137 a(n) is the least number whose binary representation has the same number of 0's and 1's as n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 5, 7, 8, 9, 9, 11, 9, 11, 11, 15, 16, 17, 17, 19, 17, 19, 19, 23, 17, 19, 19, 23, 19, 23, 23, 31, 32, 33, 33, 35, 33, 35, 35, 39, 33, 35, 35, 39, 35, 39, 39, 47, 33, 35, 35, 39, 35, 39, 39, 47, 35, 39, 39, 47, 39, 47, 47, 63, 64, 65, 65, 67, 65, 67, 67, 71, 65
Offset: 0

Views

Author

Reinhard Zumkeller, Jul 16 2002

Keywords

Comments

A023416(a(n)) = A023416(n), A000120(a(n)) = A000120(n).
Fixed points are { 0 } union { A099627 }. - Alois P. Heinz, Jan 30 2025

Examples

			a(20)=17, as 20='10100' and 17 is the smallest number having two 1's and three 0's: 17='10001', 18='10010', 20='10100' and 24='11000'.
		

Crossrefs

Programs

  • Maple
    a:= n-> (l-> (2^nops(l)+2^add(i, i=l))/2-1)(Bits[Split](n)):
    seq(a(n), n=0..100);  # Alois P. Heinz, Jun 26 2021
  • Mathematica
    lnb[n_]:=Module[{sidn=Sort[IntegerDigits[n,2]]},FromDigits[Join[{1}, Most[ sidn]],2]]; Join[{0},Array[lnb,80]] (* Harvey P. Dale, Aug 04 2014 *)
  • PARI
    a(n) = if(n==0,0, 1<Kevin Ryde, Jun 26 2021
  • Python
    def a(n):
        b = bin(n)[2:]; z = b.count('0'); w = len(b) - z
        return int('1'*(w > 0) + '0'*z + '1'*(w-1), 2)
    print([a(n) for n in range(73)]) # Michael S. Branicky, Jun 26 2021
    
  • Python
    def a(n): b = bin(n)[2:]; return int(b[0] + "".join(sorted(b[1:])), 2)
    print([a(n) for n in range(73)]) # Michael S. Branicky, Jun 26 2021
    

Formula

a(0)=0, a(1)=1; for n > 1, let C = 2^(floor(log_2(n))-1) = A072376(n); then a(n) = a(n-C) + C if n < 3*C; otherwise a(n) = 2*a(n - 2*C) + 1. [corrected by Jon E. Schoenfield, Jun 27 2021]
For n > 0: a(n) = (2^(A000120(n) - 1)) * (2^A023416(n) + 1) - 1. - Corrected by Michel Marcus, Nov 15 2013

A319720 Write n in 4-ary, sort digits into decreasing order.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 9, 13, 8, 9, 10, 14, 12, 13, 14, 15, 16, 20, 36, 52, 20, 21, 37, 53, 36, 37, 41, 57, 52, 53, 57, 61, 32, 36, 40, 56, 36, 37, 41, 57, 40, 41, 42, 58, 56, 57, 58, 62, 48, 52, 56, 60, 52, 53, 57, 61, 56, 57, 58, 62, 60, 61, 62, 63, 64, 80, 144, 208, 80, 84
Offset: 0

Views

Author

Seiichi Manyama, Sep 26 2018

Keywords

Crossrefs

b-ary: A073138 (b=2), A319651 (b=3), this sequence (b=4), A319722 (b=5), A319723 (b=6), A319724 (b=7), A319725 (b=8), A319726 (b=9), A004186 (b=10).

Programs

  • Mathematica
    Table[FromDigits[ReverseSort[IntegerDigits[n, 4]], 4], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n, 4), , 4), 4); \\ Michel Marcus, Sep 26 2018
  • Ruby
    def A(k, n)
      (0..n).map{|i| i.to_s(k).split('').sort.reverse.join.to_i(k)}
    end
    p A(4, 100)
    

Formula

n <= a(n) < 4n. - Charles R Greathouse IV, Aug 07 2024

A319725 Write n in 8-ary, sort digits into decreasing order.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 25, 33, 41, 49, 57, 16, 17, 18, 26, 34, 42, 50, 58, 24, 25, 26, 27, 35, 43, 51, 59, 32, 33, 34, 35, 36, 44, 52, 60, 40, 41, 42, 43, 44, 45, 53, 61, 48, 49, 50, 51, 52, 53, 54, 62, 56, 57, 58, 59, 60, 61, 62, 63, 64, 72, 136, 200, 264
Offset: 0

Views

Author

Seiichi Manyama, Sep 26 2018

Keywords

Crossrefs

b-ary: A073138 (b=2), A319651 (b=3), A319720 (b=4), A319722 (b=5), A319723 (b=6), A319724 (b=7), this sequence (b=8), A319726 (b=9), A004186 (b=10).

Programs

  • Mathematica
    Table[FromDigits[ReverseSort[IntegerDigits[n, 8]], 8], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n, 8), , 4), 8); \\ Michel Marcus, Sep 26 2018
  • Ruby
    def A(k, n)
      (0..n).map{|i| i.to_s(k).split('').sort.reverse.join.to_i(k)}
    end
    p A(8, 100)
    

Formula

n <= a(n) < 8n. - Charles R Greathouse IV, Aug 07 2024

A073139 Difference between the largest and smallest number having in binary representation the same number of 0's and 1's as n.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 1, 0, 0, 3, 3, 3, 3, 3, 3, 0, 0, 7, 7, 9, 7, 9, 9, 7, 7, 9, 9, 7, 9, 7, 7, 0, 0, 15, 15, 21, 15, 21, 21, 21, 15, 21, 21, 21, 21, 21, 21, 15, 15, 21, 21, 21, 21, 21, 21, 15, 21, 21, 21, 15, 21, 15, 15, 0, 0, 31, 31, 45, 31, 45, 45, 49, 31, 45, 45, 49, 45, 49, 49, 45, 31
Offset: 0

Views

Author

Reinhard Zumkeller, Jul 16 2002

Keywords

Comments

a(n) = A073138(n) - A073137(n).

Crossrefs

Programs

  • Mathematica
    d[n_]:=Module[{idn2=IntegerDigits[n,2]},FromDigits[Sort[idn2,#1>#2&],2]- FromDigits[ RotateRight[Sort[idn2],1],2]]; Array[d,90,0] (* Harvey P. Dale, Oct 22 2011 *)

A073141 Product of the largest and smallest number having in binary representation the same number of 0's and 1's as n.

Original entry on oeis.org

0, 1, 4, 9, 16, 30, 30, 49, 64, 108, 108, 154, 108, 154, 154, 225, 256, 408, 408, 532, 408, 532, 532, 690, 408, 532, 532, 690, 532, 690, 690, 961, 1024, 1584, 1584, 1960, 1584, 1960, 1960, 2340, 1584, 1960, 1960, 2340, 1960, 2340, 2340, 2914, 1584, 1960
Offset: 0

Views

Author

Reinhard Zumkeller, Jul 16 2002

Keywords

Comments

a(n) = A073137(n) * A073138(n).

Crossrefs

Programs

  • Mathematica
    pls[n_]:=With[{d=FromDigits[#,2]&/@Select[Permutations[IntegerDigits[n,2]],#[[1]]==1&]},Max[d]Min[d]]; Join[{0},Array[pls,50]] (* Harvey P. Dale, May 29 2025 *)

A073140 Sum of the largest and smallest number having in binary representation the same number of 0's and 1's as n.

Original entry on oeis.org

0, 2, 4, 6, 8, 11, 11, 14, 16, 21, 21, 25, 21, 25, 25, 30, 32, 41, 41, 47, 41, 47, 47, 53, 41, 47, 47, 53, 47, 53, 53, 62, 64, 81, 81, 91, 81, 91, 91, 99, 81, 91, 91, 99, 91, 99, 99, 109, 81, 91, 91, 99, 91, 99, 99, 109, 91, 99, 99, 109, 99, 109, 109, 126, 128, 161, 161, 179
Offset: 0

Views

Author

Reinhard Zumkeller, Jul 16 2002

Keywords

Comments

a(n) = A073137(n) + A073138(n).

Crossrefs

A221714 Numbers written in base 2 with digits rearranged to be in decreasing order.

Original entry on oeis.org

0, 1, 10, 11, 100, 110, 110, 111, 1000, 1100, 1100, 1110, 1100, 1110, 1110, 1111, 10000, 11000, 11000, 11100, 11000, 11100, 11100, 11110, 11000, 11100, 11100, 11110, 11100, 11110, 11110, 11111, 100000, 110000, 110000, 111000, 110000
Offset: 0

Views

Author

Bruce L. Rothschild and N. J. A. Sloane, Jan 26 2013

Keywords

Comments

This is the base-2 equivalent of A004186.

Crossrefs

For decimal equivalents see A073138.

Programs

  • Maple
    a:= n-> parse(cat(0, sort(Bits[Split](n), `>`)[])):
    seq(a(n), n=0..36);  # Alois P. Heinz, Aug 18 2025
  • Mathematica
    a[n_] := FromDigits[-Sort[-IntegerDigits[n, 2]]] (* Giovanni Resta, Jan 27 2013 *)
  • Python
    def a(n):
         return "".join(sorted(bin(n)[2:],reverse=True)) # Indranil Ghosh, Jan 09 2017
    
  • Python
    def A221714(n): return int(bin((m:=1<>n.bit_count()))[2:]) # Chai Wah Wu, Aug 18 2025

Extensions

a(18)-a(36) from Giovanni Resta, Jan 27 2013

A331857 a(n) is the greatest value obtained by partitioning the binary representation of n into consecutive blocks, and then reversing those blocks.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 6, 7, 8, 12, 12, 14, 12, 14, 14, 15, 16, 24, 24, 28, 24, 26, 28, 30, 24, 28, 28, 30, 28, 30, 30, 31, 32, 48, 48, 56, 48, 52, 56, 60, 48, 52, 52, 58, 56, 58, 60, 62, 48, 56, 56, 60, 56, 58, 60, 62, 56, 60, 60, 62, 60, 62, 62, 63, 64, 96, 96
Offset: 0

Views

Author

Rémy Sigrist, Jan 29 2020

Keywords

Examples

			For n = 6:
- the binary representation of 6 is "110",
- we can split it in 4 ways:
      "110" -> "011" -> 3
      "1" and "10" -> "1" and "01" -> 5
      "11" and "0" -> "11" and "0" -> 6
      "1" and "1" and "0" -> "1" and "1" and "0" -> 6
- we have 3 distinct values, the greatest being 6,
- hence a(6) = 6.
		

Crossrefs

See A331855 for the number of distinct values, and A331856 for the least value.

Programs

  • PARI
    See Links section.

Formula

a(n)^A023416(n) = A073138(n) (where a^k denotes the k-th iterate of n).
a(n) >= n with equality iff n belongs to A023758.
Previous Showing 11-20 of 23 results. Next