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.

A026178 a(n) is the position of n in A026177.

Original entry on oeis.org

1, 3, 4, 2, 7, 9, 10, 12, 13, 5, 16, 6, 19, 21, 22, 8, 25, 27, 28, 30, 31, 11, 34, 36, 37, 39, 40, 14, 43, 15, 46, 48, 49, 17, 52, 18, 55, 57, 58, 20, 61, 63, 64, 66, 67, 23, 70, 24, 73, 75, 76, 26, 79, 81, 82, 84, 85, 29, 88, 90, 91, 93, 94
Offset: 1

Views

Author

Keywords

Comments

Inverse of A026177.
From Kevin Ryde, Feb 06 2020: (Start)
The formulas below are seen by considering values taken in the inverse A026177. Dekking's case II there is here a(2n) = n when lowest non-0 ternary digit LNZ(n) = A060236(n) = 2, which is LNZ(2n)=1. Otherwise case III is here a(2n+1) = 3n+1 and case IV is here a(2n) = 3n. These can be combined by a floor (the inverse of the ceiling in A026177).
For positive c with LNZ(c)=1, so c = (3j+1)*3^k = A026225, this sequence has a self-similarity in that taking the values which are multiples of c, and dividing them by c, gives the full sequence again. Using the inverse A026177, a(n)=c*m here is located at n = A026177(c*m) = c*A026177(m) - (floor(c/3) if m==1 (mod 3)) since c*m goes to the same bigger or smaller case in A026177 as m does. Then since floor(c/2) < c, values c*m are in the same order as all values m.
(End)

Crossrefs

Cf. A026177 (inverse).

Programs

  • Mathematica
    Values[Take[#, LengthWhile[Differences@ Keys@ #, # == 1 &]]][[All, 1]] &@ KeySort@ PositionIndex@ Array[If[Mod[#/3^IntegerExponent[#, 3], 3] == 1, Ceiling[2 #/3], 2 #] &, 94] (* or *)
    Block[{nn = 63, s}, s = Array[If[Mod[#/3^IntegerExponent[#, 3], 3] == 1, Ceiling[2 #/3], 2 #] &, Ceiling[3 nn/2]]; Array[FirstPosition[s, #][[1]] &, nn]] (* Michael De Vlieger, Feb 08 2020 *)
  • PARI
    a(n) = if(n%2 || (n/3^valuation(n,3))%3==2, floor(3*n/2), n/2);

Formula

From Kevin Ryde, Feb 06 2020: (Start)
a(n) = n/2 if n even and A060236(n)=1, otherwise a(n) = floor(3n/2), where A060236(n) is the lowest non-0 ternary digit of n.
a(3n) = 3*a(n) + (1 if n odd).
(End)

Extensions

Edited by N. J. A. Sloane, Feb 05 2020