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

A319954 Infinite word over {0,1,2} formed from list of binary words of lengths 0, 1, 2, etc., including empty word, each prefixed by a 2.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Oct 04 2018

Keywords

Examples

			The word written without commas:
220212002012102112000200120102011210021012110211120000200012001020011...
		

Crossrefs

Programs

  • PARI
    k=0; for (n=0, oo, b=binary(n+1); b[1]++; for (i=1, #b, print1 (b[i] ", "); if (k++==87, quit))) \\ Rémy Sigrist, Oct 04 2018

Formula

a(n) = A030302(n+1) + [n belongs to A001855] (where [] is an Iverson bracket). - Rémy Sigrist, Oct 04 2018

Extensions

Data corrected and extended by Rémy Sigrist, Oct 04 2018

A346524 Write n in ternary, replace each 2 with -1, interpret each "-" as a subtraction operator, and evaluate the resulting expression in ternary.

Original entry on oeis.org

0, 1, -1, 3, 4, 0, -3, -4, -2, 9, 10, 2, 12, 13, 3, -2, -3, -1, -9, -10, -4, -12, -13, -5, -4, -5, -3, 27, 28, 8, 30, 31, 9, 0, -1, 1, 36, 37, 11, 39, 40, 12, 1, 0, 2, -8, -9, -3, -11, -12, -4, -3, -4, -2, -27, -28, -10, -30, -31, -11, -6, -7, -5, -36, -37
Offset: 0

Views

Author

Johnathan Abdoo, Jul 21 2021

Keywords

Comments

Instead of interpreting the -1 as done in balanced ternary (as in A117966), read the newly formed string as a mathematical expression and evaluate it in ternary as if each "-" is a subtraction operator.
Those n which do not contain a 2 in ternary (A005836) remain unchanged and are record highs.
Those n which in ternary are a binary number prefixed by a 2 (A319953) give the record lows.

Examples

			For n = 208893 = 101121112210_3, changing each 2 to a -1 gives 1011-1111-1-110; interpreting each "-" as a subtraction operator gives 1011_3 - 1111_3 - 1_3 - 110_3 = 31 - 40 - 1 - 12 = -22, so a(208893) = -22.
For n = 25 = 221_3, changing the 2's to (-1)'s gives -1-11; interpreting the leading "-" as a unary minus (so the expression starts with a negative 1) and the remaining "-" as a subtraction operator gives -1_3 - 11_3 = -1 - 4 = -5, so a(25) = -5.
		

Crossrefs

Cf. A005836 (fixed points), A319953.
Cf. A117966.

Programs

  • PARI
    a(n) = my(v=digits(n,3),lo=#v,ret=0); forstep(i=#v,1,-1, if(v[i]==2, v[i]=1; ret -= fromdigits(v[i..lo],3); lo=i-1)); ret + fromdigits(v[1..lo],3); \\ Kevin Ryde, Jul 23 2021
Showing 1-2 of 2 results.