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

A163327 Self-inverse permutation of integers: swap the odd- and even-positioned digits in the ternary expansion of n, then convert back to decimal.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Examples

			11 in ternary base (A007089) is written as '(000...)102' (... + 0*27 + 1*9 + 0*3 + 2), which results '1020' = 1*27 + 0*9 + 2*3 + 0 = 33, when the odd- and even-positioned digits are swapped, thus a(11) = 33.
		

Crossrefs

Programs

  • Python
    from sympy.ntheory import digits
    def a(n):
        d = digits(n, 3)[1:]
        return sum(3**(i+(1-2*(i&1)))*di for i, di in enumerate(d[::-1]))
    print([a(n) for n in range(72)]) # Michael S. Branicky, Aug 05 2022
  • Scheme
    (define (A163327 n) (+ (A037314 (A163326 n)) (* 3 (A037314 (A163325 n)))))
    

Formula

a(n) = A037314(A163326(n)) + 3*A037314(A163325(n))

Extensions

Edited by Charles R Greathouse IV, Nov 01 2009

A163325 Pick digits at the even distance from the least significant end of the ternary expansion of n, then convert back to decimal.

Original entry on oeis.org

0, 1, 2, 0, 1, 2, 0, 1, 2, 3, 4, 5, 3, 4, 5, 3, 4, 5, 6, 7, 8, 6, 7, 8, 6, 7, 8, 0, 1, 2, 0, 1, 2, 0, 1, 2, 3, 4, 5, 3, 4, 5, 3, 4, 5, 6, 7, 8, 6, 7, 8, 6, 7, 8, 0, 1, 2, 0, 1, 2, 0, 1, 2, 3, 4, 5, 3, 4, 5, 3, 4, 5, 6, 7, 8, 6, 7, 8, 6, 7, 8, 9, 10, 11, 9, 10, 11, 9, 10, 11, 12, 13, 14, 12, 13, 14
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Examples

			11 in ternary base (A007089) is written as '102' (1*9 + 0*3 + 2), from which we pick the "zeroth" and 2nd digits from the right, giving '12' = 1*3 + 2 = 5, thus a(11) = 5.
		

Crossrefs

A059905 is an analogous sequence for binary.

Programs

  • PARI
    a(n) = fromdigits(digits(n,9)%3,3); \\ Kevin Ryde, May 14 2020

Formula

a(0) = 0, a(n) = (n mod 3) + 3*a(floor(n/9)).
a(n) = Sum_{k>=0} {A030341(n,k)*b(k)} where b is the sequence (1,0,3,0,9,0,27,0,81,0,243,0... = A254006): powers of 3 alternating with zeros. - Philippe Deléham, Oct 22 2011
A037314(a(n)) + 3*A037314(A163326(n)) = n for all n.

Extensions

Edited by Charles R Greathouse IV, Nov 01 2009

A163328 Square array A, where entry A(y,x) has the ternary digits of x interleaved with the ternary digits of y, converted back to decimal. Listed by antidiagonals: A(0,0), A(0,1), A(1,0), A(0,2), A(1,1), A(2,0), ...

Original entry on oeis.org

0, 1, 3, 2, 4, 6, 9, 5, 7, 27, 10, 12, 8, 28, 30, 11, 13, 15, 29, 31, 33, 18, 14, 16, 36, 32, 34, 54, 19, 21, 17, 37, 39, 35, 55, 57, 20, 22, 24, 38, 40, 42, 56, 58, 60, 81, 23, 25, 45, 41, 43, 63, 59, 61, 243, 82, 84, 26, 46, 48, 44, 64, 66, 62, 244, 246, 83, 85, 87, 47, 49
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Examples

			From _Kevin Ryde_, Oct 06 2020: (Start)
Array A(y,x) read by downwards antidiagonals, so 0, 1,3, 2,4,6, etc.
        x=0   1   2   3   4   5   6   7   8
      +--------------------------------------
  y=0 |   0,  1,  2,  9, 10, 11, 18, 19, 20,
    1 |   3,  4,  5, 12, 13, 14, 21, 22,
    2 |   6,  7,  8, 15, 16, 17, 24,
    3 |  27, 28, 29, 36, 37, 38,
    4 |  30, 31, 32, 39, 40,
    5 |  33, 34, 35, 42,
    6 |  54, 55, 56,
    7 |  57, 58,
    8 |  60,
(End)
		

Crossrefs

Inverse: A163329. Transpose: A163330. Cf. A037314 (row y=0), A208665 (column x=0)
Cf. A054238 is an analogous sequence for binary. Cf. A007089, A163327, A163332, A163334.

Programs

Formula

a(n) = A037314(A025581(n)) + 3*A037314(A002262(n))
a(n) = A163327(A163330(n)).

Extensions

Edited by Charles R Greathouse IV, Nov 01 2009

A163335 Inverse permutation to A163334.

Original entry on oeis.org

0, 1, 3, 7, 4, 2, 5, 8, 12, 17, 23, 30, 22, 16, 11, 6, 10, 15, 21, 28, 36, 46, 37, 29, 38, 47, 57, 69, 58, 48, 59, 70, 82, 96, 83, 71, 60, 50, 41, 32, 40, 49, 39, 31, 24, 18, 13, 9, 14, 19, 25, 33, 26, 20, 27, 34, 42, 52, 43, 35, 44, 53, 63, 74, 86, 99, 85, 73, 62, 51, 61, 72
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Comments

abs(A025581(a(n+1)) - A025581(a(n))) + abs(A002262(a(n+1)) - A002262(a(n))) = 1 for all n.

Crossrefs

Inverse: A163334. a(n) = A163329(A163332(n)). One-based version: A163339. See also A163337, A163358.

A163326 Pick digits at the odd distance from the least significant end of the ternary expansion of n, then convert back to decimal.

Original entry on oeis.org

0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 3, 3, 3, 4, 4, 4, 5, 5, 5, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 6, 6, 6, 7, 7, 7, 8, 8, 8, 6, 6, 6, 7, 7, 7, 8, 8, 8, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Examples

			42 in ternary base (A007089) is written as '1120' (1*27 + 1*9 + 2*3 + 0), from which we pick the first and 3rd digits from the right (zero-based!), giving '12' = 1*3 + 2 = 5, thus a(42) = 5.
		

Crossrefs

A059906 is an analogous sequence for binary. Note that A037314(A163325(n)) + 3*A037314(A163326(n)) = n for all n. Cf. A007089, A163327-A163329.

Programs

  • PARI
    a(n) = fromdigits(digits(n,9)\3,3); \\ Kevin Ryde, May 15 2020

Formula

a(n) = A163325(floor(n/3))
a(n) = Sum_{k>=0} A030341(n,k)*b(k) with (b) = (0,1,0,3,0,9,0,27,0,81,0,243,0,...): powers of 3 alternating with zeros. - Philippe Deléham, Oct 22 2011

Extensions

Edited by Charles R Greathouse IV, Nov 01 2009

A163331 Inverse permutation to A163330.

Original entry on oeis.org

0, 2, 5, 1, 4, 8, 3, 7, 12, 9, 14, 20, 13, 19, 26, 18, 25, 33, 27, 35, 44, 34, 43, 53, 42, 52, 63, 6, 11, 17, 10, 16, 23, 15, 22, 30, 24, 32, 41, 31, 40, 50, 39, 49, 60, 51, 62, 74, 61, 73, 86, 72, 85, 99, 21, 29, 38, 28, 37, 47, 36, 46, 57, 48, 59, 71, 58, 70, 83, 69, 82, 96
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Crossrefs

Inverse: A163330. a(n) = A163329(A163327(n)). Cf. A007089.

Programs

Formula

a(n) = A001477bi(A163326(n),A163325(n)), where A001477bi(x,y) = (((x+y)^2)+x+(3y))/2.
Showing 1-6 of 6 results.