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.

A060583 A ternary code related to the Tower of Hanoi.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Apr 04 2001

Keywords

Comments

Write n in base 3, then (working from left to right) if the k-th digit of n is equal to the corresponding digit to the left of the k-th digit of a(n) then this is the k-th digit of a(n), otherwise the k-th digit of a(n) is the element of {0,1,2} which has not just been compared, then read result as a base 3 number.

Examples

			a(46) = 76 since 43 = 1201_3; this gives a first digit of 2(=3-1-0), a second digit of 2(=2=2), a third digit of 1(=3-2-0) and a fourth digit of 1(=1=1); 2211_3 = 76.
		

Crossrefs

Cf. A060586, A060587 (inverse).

Formula

a(n) = 3*a(floor(n/3)) + ((-a(floor(n/3))-n) mod 3) = 3*a(floor(n/3)) + A060582(n) with a(0)=0.

A253586 The sum of the i-th ternary digits of n, k, and A(n,k) equals 0 (mod 3) for each i>=0 (leading zeros included); square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

0, 2, 2, 1, 1, 1, 6, 0, 0, 6, 8, 8, 2, 8, 8, 7, 7, 7, 7, 7, 7, 3, 6, 6, 3, 6, 6, 3, 5, 5, 8, 5, 5, 8, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 18, 3, 3, 0, 3, 3, 0, 3, 3, 18, 20, 20, 5, 2, 2, 5, 2, 2, 5, 20, 20, 19, 19, 19, 1, 1, 1, 1, 1, 1, 19, 19, 19, 24, 18, 18, 24, 0, 0, 6, 0, 0, 24, 18, 18, 24
Offset: 0

Views

Author

Alois P. Heinz, Jan 04 2015

Keywords

Examples

			Square array A(n,k) begins:
  0, 2, 1, 6, 8, 7, 3, 5, 4, ...
  2, 1, 0, 8, 7, 6, 5, 4, 3, ...
  1, 0, 2, 7, 6, 8, 4, 3, 5, ...
  6, 8, 7, 3, 5, 4, 0, 2, 1, ...
  8, 7, 6, 5, 4, 3, 2, 1, 0, ...
  7, 6, 8, 4, 3, 5, 1, 0, 2, ...
  3, 5, 4, 0, 2, 1, 6, 8, 7, ...
  5, 4, 3, 2, 1, 0, 8, 7, 6, ...
  4, 3, 5, 1, 0, 2, 7, 6, 8, ...
		

Crossrefs

Column k=0 and row n=0 gives A004488.
Main diagonal gives A001477.
A(n,floor(n/3)) gives A060587.

Programs

  • Maple
    A:= proc(n, k) local i, j; `if`(n=0 and k=0, 0,
          A(iquo(n, 3, 'i'), iquo(k, 3, 'j'))*3 +irem(6-i-j, 3))
        end:
    seq(seq(A(n, d-n), n=0..d), d=0..14);

Formula

A(n,k) = A(floor(n/3),floor(k/3))*3+(6-(n mod 3)-(k mod 3) mod 3), A(0,0) = 0.

A253587 The sum of the i-th ternary digits of n, k, and T(n,k) equals 0 (mod 3) for each i>=0 (leading zeros included); triangle T(n,k), n>=0, 0<=k<=n, read by rows.

Original entry on oeis.org

0, 2, 1, 1, 0, 2, 6, 8, 7, 3, 8, 7, 6, 5, 4, 7, 6, 8, 4, 3, 5, 3, 5, 4, 0, 2, 1, 6, 5, 4, 3, 2, 1, 0, 8, 7, 4, 3, 5, 1, 0, 2, 7, 6, 8, 18, 20, 19, 24, 26, 25, 21, 23, 22, 9, 20, 19, 18, 26, 25, 24, 23, 22, 21, 11, 10, 19, 18, 20, 25, 24, 26, 22, 21, 23, 10, 9, 11
Offset: 0

Views

Author

Alois P. Heinz, Jan 04 2015

Keywords

Examples

			Triangle T(n,k) begins:
  0;
  2, 1;
  1, 0, 2;
  6, 8, 7, 3;
  8, 7, 6, 5, 4;
  7, 6, 8, 4, 3, 5;
  3, 5, 4, 0, 2, 1, 6;
  5, 4, 3, 2, 1, 0, 8, 7;
  4, 3, 5, 1, 0, 2, 7, 6, 8;
		

Crossrefs

Column k=0 gives A004488.
Main diagonal gives A001477.
T(n,floor(n/3)) gives A060587.

Programs

  • Maple
    T:= proc(n, k) local i, j; `if`(n=0 and k=0, 0,
          T(iquo(n, 3, 'i'), iquo(k, 3, 'j'))*3 +irem(6-i-j, 3))
        end:
    seq(seq(T(n, k), k=0..n), n=0..14);

Formula

T(n,k) = T(floor(n/3),floor(k/3))*3+(6-(n mod 3)-(k mod 3) mod 3), T(0,0) = 0.

A361818 For any number k >= 0, let T_k be the triangle whose base corresponds to the ternary expansion of k (without leading zeros) and other values, say t above u and v, satisfy t = (-u-v) mod 3; this sequence lists the numbers k such that T_k has 3-fold rotational symmetry.

Original entry on oeis.org

0, 1, 2, 4, 8, 13, 26, 34, 40, 46, 59, 65, 80, 112, 121, 130, 224, 233, 242, 304, 364, 424, 518, 578, 728, 772, 862, 925, 1003, 1093, 1183, 1261, 1324, 1414, 1535, 1598, 1688, 1766, 1856, 1919, 2006, 2096, 2186, 2257, 2509, 2734, 3028, 3280, 3532, 3826, 4051
Offset: 1

Views

Author

Rémy Sigrist, Mar 25 2023

Keywords

Comments

We can devise a similar sequence for any fixed base b >= 2; the present sequence corresponds to b = 3, and A334556 corresponds to b = 2.
This sequence is infinite as it contains A048328.
If k belongs to the sequence, then A004488(k) and A030102(k) belong to the sequence.
Empirically, there are 2*3^floor((w-1)/3) positive terms with w ternary digits.
For any k, if t appears above u and v in T_k, then t + u + v = 0 (mod 3) and #{t, u, v} = 1 or 3 (the three values are either equal or all distinct); each value is uniquely determined by the two others in the same way: t = (-u-v) mod 3, u = (-t-v) mod 3, v = (-t-u) mod 3; this means that we can reconstruct T_k from any of its three sides.
If some row of T_k, say r, has w values and corresponds to the ternary expansion of m, then the row above r corresponds to the w-1 rightmost digits of the ternary expansion of A060587(m).
All positive terms belong to A297250 (their most significant digit equals their least significant digit in base 3).

Examples

			The ternary expansion of 304 is "102021", and the corresponding triangle is:
             1
            0 2
           2 1 0
          0 1 1 2
         2 1 1 1 0
        1 0 2 0 2 1
As this triangle has 3-fold rotational symmetry, 304 belongs to the sequence.
		

Crossrefs

Programs

  • PARI
    See Links section.

A060588 If the final two digits of n written in base 3 are the same then this digit, otherwise mod 3-sum of these two digits.

Original entry on oeis.org

0, 2, 1, 2, 1, 0, 1, 0, 2, 0, 2, 1, 2, 1, 0, 1, 0, 2, 0, 2, 1, 2, 1, 0, 1, 0, 2, 0, 2, 1, 2, 1, 0, 1, 0, 2, 0, 2, 1, 2, 1, 0, 1, 0, 2, 0, 2, 1, 2, 1, 0, 1, 0, 2, 0, 2, 1, 2, 1, 0, 1, 0, 2, 0, 2, 1, 2, 1, 0, 1, 0, 2, 0, 2, 1, 2, 1, 0, 1, 0, 2, 0, 2, 1, 2, 1, 0, 1, 0, 2, 0, 2, 1, 2, 1, 0, 1, 0, 2, 0, 2, 1, 2, 1, 0
Offset: 0

Views

Author

Henry Bottomley, Apr 04 2001

Keywords

Comments

From William Walkington, Sep 14 2016: (Start)
With offset 1, the y-coordinates of position vectors from the origin (point 1) to the points numbered 1 to N^2 of the magic tori that display the Agrippa odd-order-N magic squares can be expressed as follows: a(n) = (-(n-1)-floor((n-1)/N)) mod N.
This generates the y-coordinates of the magic tori that display the Agrippa order-3 "Saturn," order-5 "Mars," order-7 "Venus," order-9 "Luna," and higher-odd-order-N magic squares.
Therefore, if the odd-order-N of the torus is 3, then the resulting sequence 0,2,1,2,1,0,1,0,2 represents the y-coordinates of position vectors from the origin (point number 1) to the point numbered 1 to 9 of the magic torus that displays the Agrippa order-3 "Saturn" magic square. (End)

Examples

			a(22)=1 since 22 is written in base 3 as 211 and the final two digits are 1; a(23)=0 since 23 is written in base 3 as 212 and the final two digits are 1 and 2 and 3-(1+2)=0.
		

References

  • H.C. Agrippa, "De occulta philosophia Libri tres," (1533) translated by "J.F." (John French?) and printed by Moule, London, in 1651, Book II, chapter XXII entitled "Of the tables of the Planets, their vertues,forms, and what Divine names, Intelligencies, and Spirits are set over them."

Crossrefs

Programs

  • Mathematica
    b3d[n_]:=Module[{d3=Take[IntegerDigits[n,3],-2]},If[MatchQ[d3,{x_, x_}], d3[[1]],3-Total[d3]]]; Join[{0,2,1},Array[b3d,110,3]] (* Harvey P. Dale, Feb 29 2016 *)
    Table[If[MatchQ @@ #, First@ #, Mod[3 - Total@ #, 3]] &@ Take[PadLeft[#, 2], -2] &@ IntegerDigits[n, 3], {n, 0, 120}] (* or *)
    Table[Mod[-n - Floor[n/3], 3], {n, 0, 120}] (* Michael De Vlieger, Sep 14 2016 *)

Formula

a(n) = a(n-9) = (-[n/3]-n) mod 3 = A060587(n) mod 3.
a(n) = (-n - floor(n/3)) mod 3. - William Walkington, Sep 14 2016

A060585 Write n in base 3, then (working from left to right) if the k-th digit of n is not equal to the digit to its left then the k-th digit of a(n) is 1, otherwise it is 0, and finally read the result as a base-2 number.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Apr 04 2001

Keywords

Comments

A ternary-to-binary map.
Each k appears A001316(k) times in the sequence.

Examples

			a(76) = 10 since 76 = 2211_3 and looking for changing digits produces 1010 which, read as if in binary, is 10.
		

Crossrefs

Programs

  • PARI
    a(n) = my(v=digits(n,3)); if(#v, forstep(k=#v,2,-1, v[k]=(v[k]!=v[k-1])); v[1]=1); fromdigits(v,2); \\ Kevin Ryde, Apr 15 2021

Formula

a(n) = 2*a(floor(n/3)) + A060584(n) = A060586(A060587(n)).

Extensions

Definition rewritten by Editors of OEIS, Apr 15 2021.
Showing 1-6 of 6 results.