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.

A163528 The X-coordinate of the n-th point in the Peano curve A163334.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Aug 01 2009

Keywords

Comments

There is a 2-state automaton that accepts exactly those pairs (n,a(n)) where n is represented in base 9 and a(n) in base 3; see accompanying file a163528.pdf - Jeffrey Shallit, Aug 10 2023

Crossrefs

Formula

a(n) = A025581(A163335(n)) = A002262(A163337(n)) = A163325(A163332(n)).

Extensions

Name corrected by Kevin Ryde, Aug 28 2020

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

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

A163329 Inverse permutation to A163328.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Crossrefs

Inverse: A163328. a(n) = A163331(A163327(n)). A054239 is an analogous sequence for binary. Cf. A007089.

Programs

Formula

a(n) = A001477bi(A163325(n),A163326(n)), where A001477bi(x,y) = (((x+y)^2)+x+(3y))/2.

A338086 Duplicate the ternary digits of n, so each 0, 1 or 2 becomes 00, 11 or 22 respectively.

Original entry on oeis.org

0, 4, 8, 36, 40, 44, 72, 76, 80, 324, 328, 332, 360, 364, 368, 396, 400, 404, 648, 652, 656, 684, 688, 692, 720, 724, 728, 2916, 2920, 2924, 2952, 2956, 2960, 2988, 2992, 2996, 3240, 3244, 3248, 3276, 3280, 3284, 3312, 3316, 3320, 3564, 3568, 3572, 3600, 3604
Offset: 0

Views

Author

Kevin Ryde, Oct 09 2020

Keywords

Comments

Also, numbers whose ternary digit runs are all even lengths (including 0 reckoned as no digits at all). Also, change ternary digits 0,1,2 to base 9 digits 0,4,8, and hence numbers which can be written in base 9 using only digits 0,4,8.
Digit duplication 00,11,22 can be compared to A037314 which is 0 above each so 00,01,02, or A208665 which is 0 below each so 00,10,20. Duplication is the sum of these, or any one is a suitable multiple of another (*3, *4, etc).
This sequence is the points on the X=Y diagonal of the ternary Z-order curve (see example table in A163328). The Z-order curve takes a point number p and splits its ternary digits alternately to X and Y coordinates so X(p) = A163325(p) and Y(p) = A163326(p). Duplicate digits in a(n) are the diagonal X(a(n)) = Y(a(n)) = n.

Examples

			n=73 is ternary 2201 which duplicates to 22220011 ternary = 8804 base 9 = 6484 decimal.
		

Crossrefs

Cf. A020331 (ternary concatenation).
Digit duplication in other bases: A001196, A338754.

Programs

  • PARI
    a(n) = fromdigits(digits(n,3),9)<<2;
    
  • Python
    from gmpy2 import digits
    def A338086(n): return int(''.join(d*2 for d in digits(n,3)),3) # Chai Wah Wu, May 07 2022

Formula

a(n) = A037314(n) + A208665(n) = 4*A037314(n) = (4/3)*A208665(n).
a(n) = 4*Sum_{i=0..k} d[i]*9^i where the ternary expansion of n is n = Sum_{i=0..k} d[i]*3^i with digits d[i]=0,1,2.

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.

A105186 Replace odd-positioned digits with 0 in ternary representation of n.

Original entry on oeis.org

0, 1, 2, 0, 1, 2, 0, 1, 2, 9, 10, 11, 9, 10, 11, 9, 10, 11, 18, 19, 20, 18, 19, 20, 18, 19, 20, 0, 1, 2, 0, 1, 2, 0, 1, 2, 9, 10, 11, 9, 10, 11, 9, 10, 11, 18, 19, 20, 18, 19, 20, 18, 19, 20, 0, 1, 2, 0, 1, 2, 0, 1, 2, 9, 10, 11, 9, 10, 11, 9, 10, 11, 18, 19, 20, 18, 19, 20, 18, 19, 20, 81, 82
Offset: 0

Views

Author

Reinhard Zumkeller, Apr 11 2005

Keywords

Examples

			n = 123 = '11120' --> '10100' = 90 = a(123).
		

Crossrefs

Programs

  • Haskell
    a105186 0 = 0
    a105186 n = 9 * a105186 n' + mod t 3
                where (n', t) = divMod n 9
    -- Reinhard Zumkeller, Sep 26 2015
    
  • PARI
    a(n) = fromdigits(digits(n,9)%3,9); \\ Kevin Ryde, May 20 2020

Formula

a(n) = n - a(floor(n/3))*3, a(0) = 0.
a(n) = 9*a(floor(n/9)) + (n mod 9) mod 3. - Reinhard Zumkeller, Sep 26 2015
Showing 1-7 of 7 results.