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.

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.

A163334 Peano curve in an n X n grid, starting rightwards from the top left corner, listed antidiagonally as 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, 5, 2, 4, 6, 15, 3, 7, 47, 16, 14, 8, 46, 48, 17, 13, 9, 45, 49, 53, 18, 12, 10, 44, 50, 52, 54, 19, 23, 11, 43, 39, 51, 55, 59, 20, 22, 24, 42, 40, 38, 56, 58, 60, 141, 21, 25, 29, 41, 37, 69, 57, 61, 425, 142, 140, 26, 28, 30, 36, 70, 68, 62, 424, 426, 143, 139
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Examples

			The top left 9 X 9 corner of the array shows how this surjective self-avoiding walk begins (connect the terms in numerical order, 0-1-2-3-...):
   0  1  2 15 16 17 18 19 20
   5  4  3 14 13 12 23 22 21
   6  7  8  9 10 11 24 25 26
  47 46 45 44 43 42 29 28 27
  48 49 50 39 40 41 30 31 32
  53 52 51 38 37 36 35 34 33
  54 55 56 69 70 71 72 73 74
  59 58 57 68 67 66 77 76 75
  60 61 62 63 64 65 78 79 80
		

Crossrefs

Transpose: A163336. Inverse: A163335. One-based version: A163338. Row sums: A163342. Row 0: A163480. Column 0: A163481. Central diagonal: A163343.
See A163357 and A163359 for the Hilbert curve.

Programs

  • Mathematica
    b[{n_, k_}, {m_}] := (A[k, n] = m - 1);
    MapIndexed[b, List @@ PeanoCurve[4][[1]]];
    Table[A[n - k, k], {n, 0, 12}, {k, n, 0, -1}] // Flatten (* Jean-François Alcover, Mar 07 2021 *)

Formula

a(n) = A163332(A163328(n)).

Extensions

Links to further derived sequences added by Antti Karttunen, Sep 21 2009
Name corrected by Kevin Ryde, Aug 22 2020

A163336 Peano curve in an n X n grid, starting downwards from the top left corner, listed antidiagonally as A(0,0), A(0,1), A(1,0), A(0,2), A(1,1), A(2,0), ...

Original entry on oeis.org

0, 5, 1, 6, 4, 2, 47, 7, 3, 15, 48, 46, 8, 14, 16, 53, 49, 45, 9, 13, 17, 54, 52, 50, 44, 10, 12, 18, 59, 55, 51, 39, 43, 11, 23, 19, 60, 58, 56, 38, 40, 42, 24, 22, 20, 425, 61, 57, 69, 37, 41, 29, 25, 21, 141, 426, 424, 62, 68, 70, 36, 30, 28, 26, 140, 142, 431, 427
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Examples

			The top left 9 X 9 corner of the array shows how this surjective self-avoiding walk begins (connect the terms in numerical order, 0-1-2-3-...):
   0  5  6 47 48 53 54 59 60
   1  4  7 46 49 52 55 58 61
   2  3  8 45 50 51 56 57 62
  15 14  9 44 39 38 69 68 63
  16 13 10 43 40 37 70 67 64
  17 12 11 42 41 36 71 66 65
  18 23 24 29 30 35 72 77 78
  19 22 25 28 31 34 73 76 79
  20 21 26 27 32 33 74 75 80
		

Crossrefs

Transpose: A163334. Inverse: A163337. a(n) = A163332(A163330(n)) = A163327(A163333(A163328(n))) = A163334(A061579(n)). One-based version: A163340. Row sums: A163342. Row 0: A163481. Column 0: A163480. Central diagonal: A163343.
See A163357 and A163359 for the Hilbert curve.

Programs

  • Mathematica
    b[{n_, k_}, {m_}] := (A[n, k] = m - 1);
    MapIndexed[b, List @@ PeanoCurve[4][[1]]];
    Table[A[n - k, k], {n, 0, 12}, {k, n, 0, -1}] // Flatten (* Jean-François Alcover, Mar 07 2021 *)

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

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

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.

A163330 Square array A, where entry A(y,x) has the ternary digits of y interleaved with the ternary digits of x, 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, 3, 1, 6, 4, 2, 27, 7, 5, 9, 30, 28, 8, 12, 10, 33, 31, 29, 15, 13, 11, 54, 34, 32, 36, 16, 14, 18, 57, 55, 35, 39, 37, 17, 21, 19, 60, 58, 56, 42, 40, 38, 24, 22, 20, 243, 61, 59, 63, 43, 41, 45, 25, 23, 81, 246, 244, 62, 66, 64, 44, 48, 46, 26, 84, 82, 249, 247, 245
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Crossrefs

Inverse: A163331. a(n) = A163327(A163328(n)). Transpose: A163328. Cf. A007089, A163327, A163332, A163334.

Programs

Formula

a(n) = 3*A037314(A025581(n)) + A037314(A002262(n))
Showing 1-7 of 7 results.