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

A319785 a(n) = A073138(n) + A038573(n).

Original entry on oeis.org

0, 2, 3, 6, 5, 9, 9, 14, 9, 15, 15, 21, 15, 21, 21, 30, 17, 27, 27, 35, 27, 35, 35, 45, 27, 35, 35, 45, 35, 45, 45, 62, 33, 51, 51, 63, 51, 63, 63, 75, 51, 63, 63, 75, 63, 75, 75, 93, 51, 63, 63, 75, 63, 75, 75, 93, 63, 75, 75, 93, 75, 93, 93, 126, 65, 99, 99, 119
Offset: 0

Views

Author

Seiichi Manyama, Sep 27 2018

Keywords

Comments

This sequence is different from A055944. For example, A055944(5) = 10 and a(5) = 9.

Crossrefs

Base b: this sequence (b=2), A319803 (b=3), A319804 (b=4), A319805 (b=5), A319806 (b=6), A319807 (b=7), A319808 (b=8), A319747 (b=9), A052008 (b=10).

Programs

  • Mathematica
    Table[FromDigits[Reverse[#], 2] + FromDigits[#, 2] & [Sort[IntegerDigits[n, 2]]], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n) = my(dn=binary(n)); fromdigits(vecsort(dn), 2) + fromdigits(vecsort(dn,,4), 2); \\ Michel Marcus, Sep 28 2018

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

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 2, 3, 0, 1, 0, 0, 0, 7, 6, 9, 4, 7, 6, 7, 0, 3, 2, 3, 0, 1, 0, 0, 0, 15, 14, 21, 12, 19, 18, 21, 8, 15, 14, 17, 12, 15, 14, 15, 0, 7, 6, 9, 4, 7, 6, 7, 0, 3, 2, 3, 0, 1, 0, 0, 0, 31, 30, 45, 28, 43, 42, 49, 24, 39, 38, 45, 36, 43, 42, 45, 16
Offset: 0

Views

Author

Seiichi Manyama, Sep 25 2018

Keywords

Crossrefs

Programs

  • PARI
    a(n) = fromdigits(vecsort(binary(n),,4), 2) - n; \\ Michel Marcus, Sep 25 2018
  • Ruby
    def A(k, n)
      (0..n).map{|i| i.to_s(k).split('').sort.reverse.join.to_i(k) - i}
    end
    p A(2, 100)
    

A380544 Numbers of the form A073138(k) XOR A038573(k).

Original entry on oeis.org

0, 3, 5, 9, 15, 17, 27, 33, 51, 63, 65, 99, 119, 129, 195, 231, 255, 257, 387, 455, 495, 513, 771, 903, 975, 1023, 1025, 1539, 1799, 1935, 2015, 2049, 3075, 3591, 3855, 3999, 4095, 4097, 6147, 7175, 7695, 7967, 8127, 8193, 12291, 14343, 15375, 15903, 16191, 16383, 16385
Offset: 1

Views

Author

Keywords

Comments

The plot of the sequence has a blancmange appearance. The discontinuities in the curve are at a(n) = k^2 + 1.
The bit length of a(n+1) appears to be A000267(n)+1.
The number of 0-bits in the binary expansion of a(n+1) appears to be A082375(n).

Examples

			k = 17. A073138(17) = 24 = 11000_2. A038573(17) = 3 = 00011_2. 11000_2 XOR 00011_2 = 11011_2 = 27. 27 is a term.
		

Crossrefs

Subsequence of A006995.

Programs

  • Mathematica
    s[n_, k_] := (2^n-1)*(2^(k-n)+1); Join[{0}, Table[s[n, k], {k, 2, 15}, {n, 1, Floor[k/2]}] // Flatten] (* Amiram Eldar, Jun 23 2025 *)
  • PARI
    a8(n) = fromdigits(vecsort(binary(n), , 4), 2);
    a3(n) = 2^hammingweight(n)-1;
    lista(nn) = Set(vector(nn, n, bitxor(a3(n), a8(n)))); \\ Michel Marcus, Jun 23 2025

Extensions

More terms from Michel Marcus, Jun 23 2025

A004086 Read n backwards (referred to as R(n) in many sequences).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 2, 12, 22, 32, 42, 52, 62, 72, 82, 92, 3, 13, 23, 33, 43, 53, 63, 73, 83, 93, 4, 14, 24, 34, 44, 54, 64, 74, 84, 94, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 6, 16, 26, 36, 46, 56, 66, 76, 86, 96, 7, 17, 27, 37, 47
Offset: 0

Views

Author

Keywords

Comments

Also called digit reversal of n.
Leading zeros (after the reversal has taken place) are omitted. - N. J. A. Sloane, Jan 23 2017

Crossrefs

Programs

  • Haskell
    a004086 = read . reverse . show  -- Reinhard Zumkeller, Apr 11 2011
    
  • J
    |.&.": i.@- 1e5 NB. Stephen Makdisi, May 14 2018
  • Maple
    read transforms; A004086 := digrev; #cf "Transforms" link at bottom of page
    A004086:=proc(n) local s,t; if n<10 then n else s:=irem(n,10,'t'); while t>9 do s:=s*10+irem(t,10,'t') od: s*10+t fi end; # M. F. Hasler, Jan 29 2012
  • Mathematica
    Table[FromDigits[Reverse[IntegerDigits[n]]], {n, 0, 75}]
    IntegerReverse[Range[0,80]](* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 13 2018 *)
  • PARI
    dig(n) = {local(m=n,r=[]); while(m>0,r=concat(m%10,r);m=floor(m/10));r}
    A004086(n) = {local(b,m,r);r=0;b=1;m=dig(n);for(i=1,matsize(m)[2],r=r+b*m[i];b=b*10);r} \\ Michael B. Porter, Oct 16 2009
    
  • PARI
    A004086(n)=fromdigits(Vecrev(digits(n))) \\ M. F. Hasler, Nov 11 2010, updated May 11 2015, Sep 13 2019
    
  • Python
    def A004086(n):
        return int(str(n)[::-1]) # Chai Wah Wu, Aug 30 2014
    

Formula

For n > 0, a(a(n)) = n iff n mod 10 != 0. - Reinhard Zumkeller, Mar 10 2002
a(n) = d(n,0) with d(n,r) = r if n=0, otherwise d(floor(n/10), r*10+(n mod 10)). - Reinhard Zumkeller, Mar 04 2010
a(10*n+x) = x*10^m + a(n) if 10^(m-1) <= n < 10^m and 0 <= x <= 9. - Robert Israel, Jun 11 2015

Extensions

Extended by Ray Chandler, Dec 30 2004

A004185 Arrange digits of n in increasing order, then (for n > 0) omit the zeros.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 12, 22, 23, 24, 25, 26, 27, 28, 29, 3, 13, 23, 33, 34, 35, 36, 37, 38, 39, 4, 14, 24, 34, 44, 45, 46, 47, 48, 49, 5, 15, 25, 35, 45, 55, 56, 57, 58, 59, 6, 16, 26, 36, 46, 56, 66, 67, 68, 69, 7, 17, 27, 37, 47
Offset: 0

Views

Author

Keywords

Comments

Record values: A009994. - Reinhard Zumkeller, Dec 05 2009
If we define "sortable primes" as prime numbers that remain prime when their digits are sorted in increasing order, then all absolute primes (A003459) are sortable primes but not all sortable primes are absolute primes. For example, 311 is both sortable and absolute, and 271 is sortable but not absolute, since its digits can be permuted to 217 = 7 * 31 or 712 = 2^3 * 89, etc. - Alonso del Arte, Oct 05 2013
The above mentioned "sortable primes" are listed in A211654, the nontrivial ones (with digits not in nondecreasing order) in A086042. - M. F. Hasler, Jul 30 2019

Examples

			a(19) = 19 because the digits are already in increasing order.
a(20) = 2 because the digits of 20 are 2 and 0, which in increasing order are 0 and 2, but since zero-padding is not allowed on the left, the zero digit is dropped and we are left with 2.
a(21) = 12 because the digits of 21 are 2 and 1, which in increasing order are 1 and 2.
		

Crossrefs

Cf. A211654 (sortable primes) and subsequence A086042 (nontrivial solutions).

Programs

  • Haskell
    import Data.List (sort)
    a004185 n = read $ sort $ show n :: Integer
    -- Reinhard Zumkeller, Aug 10 2011
    
  • Magma
    A004185:=func; [n eq 0 select 0 else A004185(n): n in [0..57]]; // Bruno Berselli, Apr 03 2012
    
  • Maple
    A004185 := proc(n)
        local dgs;
        convert(n,base,10) ;
        dgs := sort(%,`>`) ;
        add( op(i,dgs)*10^(i-1),i=1..nops(dgs)) ;
    end proc:
    seq(A004185(n),n=0..20) ; # R. J. Mathar, Jul 26 2015
  • Mathematica
    FromDigits[Sort[DeleteCases[IntegerDigits[#], 0]]]&/@Range[0, 60] (* Harvey P. Dale, Nov 29 2011 *)
  • PARI
    a(n)=fromdigits(vecsort(digits(n))) \\ Charles R Greathouse IV, Feb 06 2017
  • Python
    def A004185(n):
        return int(''.join(sorted(str(n))).replace('0','')) if n > 0 else 0 # Chai Wah Wu, Nov 10 2015
    

A038573 a(n) = 2^A000120(n) - 1.

Original entry on oeis.org

0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, 3, 7, 7, 15, 7, 15, 15, 31
Offset: 0

Views

Author

Keywords

Comments

Essentially the same sequence as A001316, which has much more information, and also A159913. - N. J. A. Sloane, Jun 05 2009
Smallest number with same number of 1's in its binary expansion as n.
Fixed point of the morphism 0 -> 01, 1 -> 13, 3 -> 37, ... = k -> k, 2k+1, ... starting from a(0) = 0; 1 -> 01 -> 0113 -> 01131337 -> 011313371337377(15) -> ..., . - Robert G. Wilson v, Jan 24 2006
From Gary W. Adamson, Jun 04 2009: (Start)
As an infinite string, 2^n terms per row starting with "1": (1; 1,3; 1,3,3,7; 1,3,3,7,3,7,7,15; 1,3,3,7,3,7,7,15,3,7,7,15,7,15,15,31;...)
Row sums of that triangle = A027649: (1, 4, 14, 46, 454, ...); where the next row sum = current term of A027649 + next term in finite difference row of A027649, i.e., (1, 3, 10, 32, 100, 308, ...) = A053581. (End)
From Omar E. Pol, Jan 24 2016: (Start)
Partial sums give A267700.
a(n) is also the number of cells turned ON at n-th generation of the cellular automaton of A267700 in a 90-degree sector on the square grid.
a(n) is also the number of Y-toothpicks added at n-th generation of the structure of A267700 in a 120-degree sector on the triangular grid. (End)
Row sums of A090971. - Nikolaos Pantelidis, Nov 23 2022

Examples

			9 = 1001 -> 0011 -> 3, so a(9)=3.
From _Gary W. Adamson_, Jun 04 2009: (Start)
Triangle read by rows:
  1;
  1, 3;
  1, 3, 3, 7;
  1, 3, 3, 7, 3, 7, 7, 15;
  1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31;
  ...
Row sums: (1, 4, 14, 46, ...) = A027649 = last row terms + new set of terms such that row 3 = (1, 3, 3, 7,) + (3, 7, 7, 15) = 14 + 32 = A027649(2) + A053581(3). (End)
The rows of this triangle converge to A159913. - _N. J. A. Sloane_, Jun 05 2009
G.f. = x + x^2 + 3*x^3 + x^4 + 3*x^5 + 3*x^6 + 7*x^7 + x^8 + 3*x^9 + 3*x^10 + 7*x^11 + ... - _Michael Somos_, Jul 24 2023
		

Crossrefs

This is Guy Steele's sequence GS(3, 6) (see A135416).
Write n in b-ary, sort digits into increasing order: this sequence (b=2), A038574 (b=3), A319652 (b=4), A319653 (b=5), A319654 (b=6), A319655 (b=7), A319656 (b=8), A319657 (b=9), A004185 (b=10).
Column k=0 of A340666.

Programs

  • Haskell
    a038573 0 = 0
    a038573 n = (m + 1) * (a038573 n') + m where (n', m) = divMod n 2
    -- Reinhard Zumkeller, Oct 10 2012, Feb 07 2011
    (Python 3.10+)
    def A038573(n): return (1<Chai Wah Wu, Nov 15 2022
  • Maple
    seq(2^convert(convert(n,base,2),`+`)-1, n=0..100); # Robert Israel, Jan 24 2016
  • Mathematica
    Array[ 2^Count[ IntegerDigits[ #, 2 ], 1 ]-1&, 100 ]
    Nest[ Flatten[ # /. a_Integer -> {a, 2a + 1}] &, {0}, 7] (* Robert G. Wilson v, Jan 24 2006 *)
  • PARI
    {a(n) = 2^subst(Pol(binary(n)), x, 1) - 1};
    
  • PARI
    a(n) = 2^hammingweight(n)-1; \\ Michel Marcus, Jan 24 2016
    

Formula

a(2n) = a(n), a(2n+1) = 2*a(n)+1, a(0) = 0. a(n) = A001316(n)-1 = 2^A000120(n) - 1. - Daniele Parisse
a(n) = number of positive integers k < n such that n XOR k = n-k (cf. A115378). - Paul D. Hanna, Jan 21 2006
a(n) = f(n, 1) with f(x, y) = if x = 0 then y - 1 else f(floor(x/2), y*(1 + x mod 2)). - Reinhard Zumkeller, Nov 21 2009
a(n) = (n mod 2 + 1) * a(floor(n/2)) + n mod 2. - Reinhard Zumkeller, Oct 10 2012
a(n) = Sum_{i=1..n} C(n,i) mod 2. - Wesley Ivan Hurt, Nov 17 2017
G.f.: -1/(1 - x) + Product_{k>=0} (1 + 2*x^(2^k)). - Ilya Gutkovskiy, Aug 20 2019
G.f. A(x) = x + x^2*A(x) + (1 + 2*x)*(1 - x^2)*A(x^2). - Michael Somos, Jul 24 2023

Extensions

More terms from Erich Friedman
New definition from N. J. A. Sloane, Mar 01 2008

A256999 a(n)=n for n <= 1; for n >= 2, a(n) = largest number that can be obtained by rotating non-msb bits of binary expansion of n (with A080541 or A080542).

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, 26, 30, 28, 30, 30, 31, 32, 48, 48, 56, 48, 52, 56, 60, 48, 52, 52, 58, 56, 58, 60, 62, 48, 56, 52, 60, 52, 58, 58, 62, 56, 60, 58, 62, 60, 62, 62, 63, 64, 96, 96, 112, 96, 104, 112, 120, 96, 100, 104, 114, 112, 116, 120, 124, 96, 104, 100
Offset: 0

Views

Author

Antti Karttunen, May 16 2015

Keywords

Crossrefs

Cf. A257250 (fixed points of this sequence).
Cf. also A163380 (analogous sequence when rotating all bits of binary representation).

A319722 Write n in 5-ary, sort digits into decreasing order.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 11, 16, 21, 10, 11, 12, 17, 22, 15, 16, 17, 18, 23, 20, 21, 22, 23, 24, 25, 30, 55, 80, 105, 30, 31, 56, 81, 106, 55, 56, 61, 86, 111, 80, 81, 86, 91, 116, 105, 106, 111, 116, 121, 50, 55, 60, 85, 110, 55, 56, 61, 86, 111, 60, 61, 62, 87, 112, 85
Offset: 0

Views

Author

Seiichi Manyama, Sep 26 2018

Keywords

Crossrefs

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

Programs

  • Mathematica
    Table[FromDigits[ReverseSort[IntegerDigits[n, 5]], 5], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n, 5), , 4), 5); \\ 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(5, 100)
    

Formula

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

A319723 Write n in 6-ary, sort digits into decreasing order.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 13, 19, 25, 31, 12, 13, 14, 20, 26, 32, 18, 19, 20, 21, 27, 33, 24, 25, 26, 27, 28, 34, 30, 31, 32, 33, 34, 35, 36, 42, 78, 114, 150, 186, 42, 43, 79, 115, 151, 187, 78, 79, 85, 121, 157, 193, 114, 115, 121, 127, 163, 199, 150, 151, 157, 163
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), this sequence (b=6), A319724 (b=7), A319725 (b=8), A319726 (b=9), A004186 (b=10).

Programs

  • Mathematica
    Table[FromDigits[ReverseSort[IntegerDigits[n, 6]], 6], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n, 6), , 4), 6); \\ 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(6, 100)
    

Formula

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

A319651 Largest number having in its ternary representation the same number of 0's, 1's and 2's as n.

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 6, 7, 8, 9, 12, 21, 12, 13, 22, 21, 22, 25, 18, 21, 24, 21, 22, 25, 24, 25, 26, 27, 36, 63, 36, 39, 66, 63, 66, 75, 36, 39, 66, 39, 40, 67, 66, 67, 76, 63, 66, 75, 66, 67, 76, 75, 76, 79, 54, 63, 72, 63, 66, 75, 72, 75, 78, 63, 66, 75, 66, 67, 76, 75, 76
Offset: 0

Views

Author

Seiichi Manyama, Sep 25 2018

Keywords

Crossrefs

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

Programs

  • Mathematica
    Table[FromDigits[ReverseSort[IntegerDigits[n, 3]], 3], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n, 3),,4), 3); \\ Michel Marcus, Sep 25 2018
    
  • Python
    from gmpy2 import digits
    def A319651(n):
        return int(''.join(sorted(digits(n,3),reverse=True)),3) # Chai Wah Wu, 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(3, 100)
    

Formula

n <= a(n) < 3n. - Charles R Greathouse IV, Aug 07 2024
Showing 1-10 of 23 results. Next