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

A263273 Bijective base-3 reverse: a(0) = 0; for n >= 1, a(n) = A030102(A038502(n)) * A038500(n).

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 6, 5, 8, 9, 10, 19, 12, 13, 22, 21, 16, 25, 18, 11, 20, 15, 14, 23, 24, 17, 26, 27, 28, 55, 30, 37, 64, 57, 46, 73, 36, 31, 58, 39, 40, 67, 66, 49, 76, 63, 34, 61, 48, 43, 70, 75, 52, 79, 54, 29, 56, 33, 38, 65, 60, 47, 74, 45, 32, 59, 42, 41, 68, 69, 50, 77, 72, 35, 62, 51, 44, 71, 78, 53, 80, 81
Offset: 0

Views

Author

Antti Karttunen, Dec 05 2015

Keywords

Comments

Here the base-3 reverse has been adjusted so that the maximal suffix of trailing zeros (in base-3 representation A007089) stays where it is at the right side, and only the section from the most significant digit to the least significant nonzero digit is reversed, thus making this sequence a self-inverse permutation of nonnegative integers.
Because successive powers of 3 and 9 modulo 2, 4 and 8 are always either constant 1, 1, 1, ... or alternating 1, -1, 1, -1, ... it implies similar simple divisibility rules for 2, 4 and 8 in base 3 as e.g. 3, 9 and 11 have in decimal base (see the Wikipedia-link). As these rules do not depend on which direction they are applied from, it means that this bijection preserves the fact whether a number is divisible by 2, 4 or 8, or whether it is not. Thus natural numbers are divided to several subsets, each of which is closed with respect to this bijection. See the Crossrefs section for permutations obtained from these sections.
When polynomials over GF(3) are encoded as natural numbers (coefficients presented with the digits of the base-3 expansion of n), this bijection works as a multiplicative automorphism of the ring GF(3)[X]. This follows from the fact that as there are no carries involved, the multiplication (and thus also the division) of such polynomials could be as well performed by temporarily reversing all factors (like they were seen through mirror). This implies also that the sequences A207669 and A207670 are closed with respect to this bijection.

Examples

			For n = 15, A007089(15) = 120. Reversing this so that the trailing zero stays at the right yields 210 = A007089(21), thus a(15) = 21 and vice versa, a(21) = 15.
		

Crossrefs

Bisections: A264983, A264984.
Permutations induced by various sections: A263272 (a(2n)/2), A264974 (a(4n)/4), A264978 (a(8n)/8), A264985, A264989.
Cf. also A004488, A140263, A140264, A246207, A246208 (other base-3 related permutations).

Programs

  • Mathematica
    r[n_] := FromDigits[Reverse[IntegerDigits[n, 3]], 3]; b[n_] := n/ 3^IntegerExponent[n, 3]; c[n_] := n/b[n]; a[0]=0; a[n_] := r[b[n]]*c[n]; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Dec 29 2015 *)
  • Python
    from sympy import factorint
    from sympy.ntheory.factor_ import digits
    from operator import mul
    def a030102(n): return 0 if n==0 else int(''.join(map(str, digits(n, 3)[1:][::-1])), 3)
    def a038502(n):
        f=factorint(n)
        return 1 if n==1 else reduce(mul, [1 if i==3 else i**f[i] for i in f])
    def a038500(n): return n/a038502(n)
    def a(n): return 0 if n==0 else a030102(a038502(n))*a038500(n) # Indranil Ghosh, May 22 2017
  • Scheme
    (define (A263273 n) (if (zero? n) n (* (A030102 (A038502 n)) (A038500 n))))
    

Formula

a(0) = 0; for n >= 1, a(n) = A030102(A038502(n)) * A038500(n).
Other identities. For all n >= 0:
a(3*n) = 3*a(n).
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]
A010873(a(n)) = 0 if and only if A010873(n) = 0. [See the comments section.]

A264980 Base-3 reversal of 2^n: a(n) = A030102(A000079(n)).

Original entry on oeis.org

1, 2, 4, 8, 16, 64, 32, 184, 352, 704, 1408, 1880, 2824, 14032, 10328, 56128, 100576, 145784, 189472, 370304, 731752, 4388248, 2924096, 11175712, 15965704, 31930448, 63861880, 383165344, 255439712, 1021772344, 510875648, 2550188248, 5619691648, 9689861048, 17830350904, 79068724264, 34109913224, 192259976368, 133338241880
Offset: 0

Views

Author

Antti Karttunen, Dec 05 2015

Keywords

Examples

			2^5 = 32 in base 3 = "1012" (= A007089(32)) as 1*27 + 1*3 + 2*1 = 32. 2^6 = 64 in base 3 = "2101" as 2*27 + 1*9 + 1*1 = 64. "1012" reversed is "2101" and vice versa, thus a(5) = 64 and a(6) = 32.
		

Crossrefs

Leftmost column of A265345.
Cf. also A036215.

Programs

  • PARI
    base(n) = {my(a=[n%3]); while(0Altug Alkan, Dec 29 2015

Formula

a(n) = A030102(A000079(n)) = A263273(A000079(n)).
a(0) = 1, for n >= 1, a(n) = A265342(a(n-1)).

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

A030101 a(n) is the number produced when n is converted to binary digits, the binary digits are reversed and then converted back into a decimal number.

Original entry on oeis.org

0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 13, 3, 11, 7, 15, 1, 17, 9, 25, 5, 21, 13, 29, 3, 19, 11, 27, 7, 23, 15, 31, 1, 33, 17, 49, 9, 41, 25, 57, 5, 37, 21, 53, 13, 45, 29, 61, 3, 35, 19, 51, 11, 43, 27, 59, 7, 39, 23, 55, 15, 47, 31, 63, 1, 65, 33, 97, 17, 81, 49, 113, 9, 73, 41, 105, 25, 89, 57
Offset: 0

Views

Author

Keywords

Comments

As with decimal reversal, initial zeros are ignored; otherwise, the reverse of 1 would be 1000000... ad infinitum.
Numerators of the binary van der Corput sequence. - Eric Rowland, Feb 12 2008
It seems that in most cases A030101(x) = A000265(x) and that if A030101(x) <> A000265(x), the next time A030101(y) = A000265(x), A030101(x) = A000265(y). Also, it seems that if a pair of values exist at one index, they will exist at any index where one of them exist. It also seems like the greater of the pair always shows up on A000265 first. - Dylan Hamilton, Aug 04 2010
The number of occasions A030101(n) = A000265(n) before n = 2^k is A053599(k) + 1. For n = 0..2^19, the sequences match less than 1% of the time. - Andrew Woods, May 19 2012
For n > 0: a(a(n)) = n if and only if n is odd; a(A006995(n)) = A006995(n). - Juli Mallett, Nov 11 2010, corrected: Reinhard Zumkeller, Oct 21 2011
n is binary palindromic if and only if a(n) = n. - Reinhard Zumkeller, corrected: Jan 17 2012, thanks to Hieronymus Fischer, who pointed this out; Oct 21 2011
Given any n > 1, the set of numbers A030109(i) = (A030101(i) - 1)/2 for indexes i ranging from 2^n to 2^(n + 1) - 1 is a permutation of the set of consecutive integers {0, 1, 2, ..., 2^n - 1}. This is important in the standard FFT algorithms (starting or ending bit-reversal permutation). - Stanislav Sykora, Mar 15 2012
Row n of A030308 gives the binary digits of a(n), prepended with zero at even positions. - Reinhard Zumkeller, Jun 17 2012
The binary van der Corput sequence is the infinite sequence of fractions { A030101(n)/A062383(n), n = 0, 1, 2, 3, ... }, and begins 0, 1/2, 1/4, 3/4, 1/8, 5/8, 3/8, 7/8, 1/16, 9/16, 5/16, 13/16, 3/16, 11/16, 7/16, 15/16, 1/32, 17/32, 9/32, 25/32, 5/32, 21/32, 13/32, 29/32, 3/32, 19/32, 11/32, 27/32, 7/32, 23/32, 15/32, 31/32, 1/64, 33/64, 17/64, 49/64, ... - N. J. A. Sloane, Dec 01 2019
Record highs occur at n = A209492(m) (for n>=1) with values a(n) = A224195(m) (for n>=3). - Bill McEachen, Aug 02 2023

Examples

			a(100) = 19 because 100 (base 10) = 1100100 (base 2) and R(1100100 (base 2)) = 10011 (base 2) = 19 (base 10).
		

References

  • Hlawka E. The theory of uniform distribution. Academic Publishers, Berkhamsted, 1984. See pp. 93, 94 for the van der Corput sequence. - N. J. A. Sloane, Dec 01 2019

Crossrefs

Cf. A055944 (reverse and add), A178225, A273258.
Cf. A056539, A057889 (bijective variants), A224195, A209492.

Programs

  • Haskell
    a030101 = f 0 where
       f y 0 = y
       f y x = f (2 * y + b) x'  where (x', b) = divMod x 2
    -- Reinhard Zumkeller, Mar 18 2014, Oct 21 2011
    
  • J
    ([: #. [: |. #:)"0 NB. Stephen Makdisi, May 07 2018
    
  • Magma
    A030101:=func; // Jason Kimberley, Sep 19 2011
    
  • Maple
    A030101 := proc(n)
        convert(n,base,2) ;
        ListTools[Reverse](%) ;
        add(op(i,%)*2^(i-1),i=1..nops(%)) ;
    end proc: # R. J. Mathar, Mar 10 2015
    # second Maple program:
    a:= proc(n) local m, r; m:=n; r:=0;
          while m>0 do r:=r*2+irem(m, 2, 'm') od; r
        end:
    seq(a(n), n=0..80);  # Alois P. Heinz, Nov 17 2015
  • Mathematica
    Table[FromDigits[Reverse[IntegerDigits[i, 2]], 2], {i, 0, 80}]
    bitRev[n_] := Switch[Mod[n, 4], 0, bitRev[n/2], 1, 2 bitRev[(n + 1)/2] - bitRev[(n - 1)/4], 2, bitRev[n/2], 3, 3 bitRev[(n - 1)/2] - 2 bitRev[(n - 3)/4]]; bitRev[0] = 0; bitRev[1] = 1; bitRev[3] = 3; Array[bitRev, 80, 0] (* Robert G. Wilson v, Mar 18 2014 *)
  • PARI
    a(n)=if(n<1,0,subst(Polrev(binary(n)),x,2))
    
  • PARI
    a(n) = fromdigits(Vecrev(binary(n)), 2); \\ Michel Marcus, Nov 10 2017
    
  • Python
    def a(n): return int(bin(n)[2:][::-1], 2) # Indranil Ghosh, Apr 24 2017
    
  • Sage
    def A030101(n): return Integer(bin(n).lstrip("0b")[::-1],2) if n!=0 else 0
    [A030101(n) for n in (0..78)]  # Peter Luschny, Aug 09 2012
    
  • Scala
    (0 to 127).map(n => Integer.parseInt(Integer.toString(n, 2).reverse, 2)) // Alonso del Arte, Feb 11 2020

Formula

a(n) = 0, a(2n) = a(n), a(2n+1) = a(n) + 2^(floor(log_2(n)) + 1). For n > 0, a(n) = 2*A030109(n) - 1. - Ralf Stephan, Sep 15 2003
a(n) = b(n, 0) with b(n, r) = r if n = 0, otherwise b(floor(n/2), 2*r + n mod 2). - Reinhard Zumkeller, Mar 03 2010
a(1) = 1, a(3) = 3, a(2n) = a(n), a(4n+1) = 2a(2n+1) - a(n), a(4n+3) = 3a(2n+1) - 2a(n) (as in the Project Euler problem). To prove this, expand the recurrence into binary strings and reversals. - David Applegate, Mar 16 2014, following a posting to the Sequence Fans Mailing List by Martin Møller Skarbiniks Pedersen.
Conjecture: a(n) = 2*w(n) - 2*w(A053645(n)) - 1 for n > 0, where w = A264596. - Velin Yanev, Sep 12 2017

Extensions

Edits (including correction of an erroneous date pointed out by J. M. Bergot) by Jon E. Schoenfield, Mar 16 2014
Name clarified by Antti Karttunen, Nov 09 2017

A263272 Self-inverse permutation of nonnegative integers: a(n) = A263273(2*n) / 2.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 11, 8, 9, 10, 7, 12, 13, 14, 15, 32, 23, 18, 29, 20, 33, 38, 17, 24, 35, 26, 27, 28, 19, 30, 37, 16, 21, 34, 25, 36, 31, 22, 39, 40, 41, 42, 95, 68, 45, 86, 59, 96, 113, 50, 69, 104, 77, 54, 83, 56, 87, 110, 47, 60, 101, 74, 99, 92, 65, 114, 119, 44, 51, 98, 71, 72, 89, 62, 105, 116, 53, 78, 107, 80, 81
Offset: 0

Views

Author

Antti Karttunen, Dec 05 2015

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{g, h}, g[x_] := x/3^IntegerExponent[x, 3]; h[x_] := x/g@ x; If[n == 0, 0, FromDigits[Reverse@ IntegerDigits[#, 3], 3] &@ g[n] h[n]]]; Table[f[2 n]/2, {n, 0, 81}] (* Michael De Vlieger, Jan 04 2016,after Jean-François Alcover at A263273 *)
  • Python
    from sympy import factorint
    from sympy.ntheory.factor_ import digits
    from operator import mul
    def a030102(n): return 0 if n==0 else int(''.join(map(str, digits(n, 3)[1:][::-1])), 3)
    def a038502(n):
        f=factorint(n)
        return 1 if n==1 else reduce(mul, [1 if i==3 else i**f[i] for i in f])
    def a038500(n): return n/a038502(n)
    def a263273(n): return 0 if n==0 else a030102(a038502(n))*a038500(n)
    def a(n): return a263273(2*n)/2 # Indranil Ghosh, May 23 2017
  • Scheme
    (define (A263272 n) (/ (A263273 (+ n n)) 2))
    

Formula

a(n) = A263273(2*n) / 2 = A264984(n) / 2.
As a composition of related permutations:
a(n) = A264974(A264975(n)) = A264976(A264974(n)).
Other identities. For all n >= 0:
a(3*n) = 3*a(n).
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]
A264974(n) = a(2n)/2. [Thus the restriction onto even numbers induces yet another permutation.]

A264974 Self-inverse permutation of natural numbers: a(n) = A263273(4*n) / 4.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 16, 9, 10, 19, 12, 13, 14, 15, 8, 17, 18, 11, 20, 21, 34, 43, 48, 25, 52, 27, 28, 55, 30, 37, 46, 57, 22, 49, 36, 31, 58, 39, 40, 41, 42, 23, 50, 45, 32, 59, 24, 35, 44, 51, 26, 53, 54, 29, 56, 33, 38, 47, 60, 61, 142, 63, 88, 169, 102, 115, 124, 129, 70, 151, 144, 97, 178, 75, 106, 133, 156, 79, 160, 81
Offset: 0

Views

Author

Antti Karttunen, Dec 05 2015

Keywords

Crossrefs

Terms of A264986 halved.
Cf. also A264975, A264976.

Programs

  • Python
    from sympy import factorint
    from sympy.ntheory.factor_ import digits
    from operator import mul
    def a030102(n): return 0 if n==0 else int(''.join(map(str, digits(n, 3)[1:][::-1])), 3)
    def a038502(n):
        f=factorint(n)
        return 1 if n==1 else reduce(mul, [1 if i==3 else i**f[i] for i in f])
    def a038500(n): return n/a038502(n)
    def a263273(n): return 0 if n==0 else a030102(a038502(n))*a038500(n)
    def a(n): return a263273(4*n)/4 # Indranil Ghosh, May 25 2017

Formula

a(n) = A263273(4*n) / 4.
a(n) = A264986(n) / 2 = A263272(2*n) / 2.
As a composition of related permutations:
a(n) = A264975(A263272(n)) = A263272(A264976(n)).
Other identities. For all n >= 0:
a(3*n) = 3*a(n).
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]
A264978(n) = a(2n)/2. [Thus the restriction onto even numbers induces yet another permutation.]

A264985 Self-inverse permutation of nonnegative integers: a(n) = (A264983(n)-1) / 2.

Original entry on oeis.org

0, 1, 3, 2, 4, 9, 6, 10, 12, 5, 7, 11, 8, 13, 27, 18, 28, 36, 15, 19, 33, 24, 31, 30, 21, 37, 39, 14, 16, 32, 23, 22, 29, 20, 34, 38, 17, 25, 35, 26, 40, 81, 54, 82, 108, 45, 55, 99, 72, 85, 90, 63, 109, 117, 42, 46, 96, 69, 58, 87, 60, 100, 114, 51, 73, 105, 78, 94, 84, 57, 91, 111, 48, 64, 102, 75, 112, 93, 66, 118, 120, 41
Offset: 0

Views

Author

Antti Karttunen, Dec 05 2015

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{g, h}, g[x_] := x/3^IntegerExponent[x, 3]; h[x_] := x/g@ x; If[n == 0, 0, FromDigits[Reverse@ IntegerDigits[#, 3], 3] &@ g[n] h[n]]]; t = Select[f /@ Range@ 1000, OddQ]; Table[(t[[n + 1]] - 1)/2, {n, 0, 81}] (* Michael De Vlieger, Jan 04 2016, after Jean-François Alcover at A263273 *)
  • Python
    from sympy import factorint
    from sympy.ntheory.factor_ import digits
    from operator import mul
    def a030102(n): return 0 if n==0 else int(''.join(map(str, digits(n, 3)[1:][::-1])), 3)
    def a038502(n):
        f=factorint(n)
        return 1 if n==1 else reduce(mul, [1 if i==3 else i**f[i] for i in f])
    def a038500(n): return n/a038502(n)
    def a263273(n): return 0 if n==0 else a030102(a038502(n))*a038500(n)
    def a(n): return (a263273(2*n + 1) - 1)/2 # Indranil Ghosh, May 22 2017
  • Scheme
    (define (A264985 n) (/ (- (A264983 n) 1) 2))
    

Formula

a(n) = (A264983(n)-1) / 2 = (1/2) * (A263273(2n + 1) - 1).

A134028 Reversal of n in balanced ternary representation.

Original entry on oeis.org

0, 1, -2, 1, 4, -11, -2, 7, -8, 1, 10, -5, 4, 13, -38, -11, 16, -29, -2, 25, -20, 7, 34, -35, -8, 19, -26, 1, 28, -17, 10, 37, -32, -5, 22, -23, 4, 31, -14, 13, 40, -119, -38, 43, -92, -11, 70, -65, 16, 97, -110, -29, 52, -83, -2, 79, -56, 25, 106, -101, -20, 61, -74, 7, 88, -47, 34, 115, -116, -35, 46, -89, -8, 73, -62, 19, 100
Offset: 0

Views

Author

Reinhard Zumkeller, Oct 19 2007

Keywords

Comments

As the graph demonstrates, the sequence makes large negative steps at terms (3^i+1)/2. These steps divide the graph into conspicuous blocks. - N. J. A. Sloane, Jul 03 2016

Examples

			20 = 1*3^3 - 1*3^2 + 1*3^1 - 1*3^0 == '+-+-'
=> a(20) = -1*3^3 + 1*3^2 - 1*3^1 + 1*3^0 = -20;
21 = 1*3^3 - 1*3^2 + 1*3^1 + 0*3^0 == '+-+0'
=> a(21) = 0*3^3 + 1*3^2 - 1*3^1 + 1*3^0 = 7;
22 = 1*3^3 - 1*3^2 + 1*3^1 + 1*3^0 == '+-++'
=> a(22) = 1*3^3 + 1*3^2 - 1*3^1 + 1*3^0 = 34;
23 = 1*3^3 + 0*3^2 - 1*3^1 - 1*3^0 == '+0--'
=> a(23) = -1*3^3 - 1*3^2 + 0*3^1 + 1*3^0 = -35;
24 = 1*3^3 + 0*3^2 - 1*3^1 + 0*3^0 == '+0-0'
=> a(24) = 0*3^3 - 1*3^2 + 0*3^1 + 1*3^0 = -8;
25 = 1*3^3 + 0*3^2 - 1*3^1 + 1*3^0 == '+0-+'
=> a(25) = 1*3^3 - 1*3^2 + 0*3^1 + 1*3^0 = 19.
		

References

  • D. E. Knuth, The Art of Computer Programming, Addison-Wesley, Reading, MA, Vol 2, pp 173-175.

Crossrefs

Cf. A117966 (balanced ternary representation), A030102, A134021, A274107.
A134027 gives the numbers whose balanced ternary representation is palindromic.

Programs

  • Python
    def a(n):
        if n==0: return 0
        s=[]
        x=0
        while n>0:
            x=n%3
            n=n//3
            if x==2:
                x=-1
                n+=1
            s.append(x)
        l=s[::-1]
        return sum(l[i]*3**i for i in range(len(l)))
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 10 2017

Formula

a(A134027(n)) = A134027(n);
A134021(ABS(a(n))) <= A134021(n).

A255588 Convert n to base 3, move the least significant digit to the most significant one and convert back to base 10.

Original entry on oeis.org

0, 1, 2, 1, 4, 7, 2, 5, 8, 3, 12, 21, 4, 13, 22, 5, 14, 23, 6, 15, 24, 7, 16, 25, 8, 17, 26, 9, 36, 63, 10, 37, 64, 11, 38, 65, 12, 39, 66, 13, 40, 67, 14, 41, 68, 15, 42, 69, 16, 43, 70, 17, 44, 71, 18, 45, 72, 19, 46, 73, 20, 47, 74, 21, 48, 75, 22, 49, 76, 23
Offset: 0

Views

Author

Paolo P. Lava, Feb 27 2015

Keywords

Comments

a(3*n) = n.
Fixed points of the transform are listed in A048328.

Examples

			10 in base 3 is 101: moving the least significant digit to the most significant one we have 110 that is 12 in base 10.
		

Crossrefs

Programs

  • Maple
    with(numtheory): P:=proc(q,h) local a,b,k,n; print(0);
    for n from 1 to q do
    a:=convert(n,base,h); b:=[]; for k from 2 to nops(a) do b:=[op(b),a[k]]; od; a:=[op(b),a[1]];
    a:=convert(a,base,h,10); b:=0; for k from nops(a) by -1 to 1 do b:=10*b+a[k]; od;
    print(b); od; end: P(10^4,3);
  • Mathematica
    roll[n_, b_] := Block[{w = IntegerDigits[n, b]}, Prepend[Most@ w, Last@ w]]; b = 3; FromDigits[#, b] & /@ (roll[#, b] & /@ Range[0, 69]) (* Michael De Vlieger, Mar 04 2015 *)
    Table[FromDigits[RotateRight[IntegerDigits[n,3]],3],{n,0,70}] (* Harvey P. Dale, Feb 20 2022 *)
  • Python
    def A255588(n):
        x=A007089(n)
        return int(x[-1]+x[:-1], 3) # Indranil Ghosh, Feb 03 2017

A265352 Permutation of nonnegative integers: a(n) = A263273(A263272(n)).

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 6, 19, 8, 9, 10, 5, 12, 13, 22, 21, 64, 23, 18, 55, 20, 57, 58, 25, 24, 73, 26, 27, 28, 11, 30, 31, 16, 15, 46, 17, 36, 37, 14, 39, 40, 67, 66, 199, 68, 63, 190, 65, 192, 193, 70, 69, 208, 71, 54, 163, 56, 165, 166, 61, 60, 181, 62, 171, 172, 59, 174, 175, 76, 75, 226, 77, 72, 217, 74, 219, 220, 79, 78, 235, 80, 81
Offset: 0

Views

Author

Antti Karttunen, Dec 07 2015

Keywords

Comments

Composition of A263273 with the permutation obtained from its even bisection.

Crossrefs

Programs

  • Python
    from sympy import factorint
    from sympy.ntheory.factor_ import digits
    from operator import mul
    def a030102(n): return 0 if n==0 else int(''.join(map(str, digits(n, 3)[1:][::-1])), 3)
    def a038502(n):
        f=factorint(n)
        return 1 if n==1 else reduce(mul, [1 if i==3 else i**f[i] for i in f])
    def a038500(n): return n/a038502(n)
    def a263273(n): return 0 if n==0 else a030102(a038502(n))*a038500(n)
    def a(n): return a263273(a263273(2*n)/2) # Indranil Ghosh, Jun 08 2017
  • Scheme
    (define (A265352 n) (A263273 (A263272 n)))
    

Formula

a(n) = A263273(A263272(n)).
As a composition of other related permutations:
a(n) = A265368(A264974(n)).
Other identities. For all n >= 0:
a(3*n) = 3*a(n).
Showing 1-10 of 36 results. Next