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.

A203602 Inverse permutation to A092401.

Original entry on oeis.org

1, 3, 2, 5, 7, 4, 9, 11, 13, 15, 17, 6, 19, 21, 8, 23, 25, 27, 29, 31, 10, 33, 35, 12, 37, 39, 14, 41, 43, 16, 45, 47, 18, 49, 51, 53, 55, 57, 20, 59, 61, 22, 63, 65, 67, 69, 71, 24, 73, 75, 26, 77, 79, 28, 81, 83, 30, 85, 87, 32, 89, 91, 93, 95, 97, 34, 99
Offset: 1

Views

Author

Reinhard Zumkeller, Jan 03 2012

Keywords

Programs

  • Haskell
    import Data.List (elemIndex)
    import Data.Maybe (mapMaybe)
    a203602 n = a203602_list !! (n-1)
    a203602_list = map (+ 1) $ mapMaybe (`elemIndex` a092401_list) [1..]
  • Mathematica
    div[n_, m_]=Floor[n/m // Chop]-Ceiling[n/m // Chop](*n not divisible by m=>-1, else 0*); ind[m_]:=Sum[(-1)^(n) div[m, 3^n], {n, 1, Floor[Log[m]/Log[3] // FullSimplify]}] + Mod[Floor[Log[3 m]/Log[3] // FullSimplify], 2];(* returns 0 or 1 depending on if we have an 'n' term (=>1) or a '3n' term (=>0) *) f[m_] := (2* Sum[(-1)^(n) Floor[m/(3^(n)) // FullSimplify], {n, 0, Floor[Log[m]/Log[3] // FullSimplify]}] - 1)* ind[m] + (1 - ind[m]) (2* Sum[(-1)^(n) Floor[m/(3^(n + 1)) // FullSimplify], {n, 0, -1 + Floor[Log[m]/Log[3] // FullSimplify]}]);
    Table[f[k], {k, 1, 50}] (* Daniel Hoying, Aug 06 2020 *)

Formula

a(n) = -2*(Sum_{k=0..-1+floor(log(n)/log(3))} (-1)^k*floor(n/3^(k+1)))*(-1 + (floor(log(3*n)/log(3)) mod 2)+Sum_{k=1..floor(log(n)/log(3))} (-1)^k*(-ceiling(n/3^k) + floor(n/3^k))) + (-1 + 2*Sum_{k=0..floor(log(n)/log(3))} (-1)^k*floor(n/3^k))*((floor(log(3*n)/log(3)) mod 2)+Sum_{k=1..floor(log(n)/log(3))} (-1)^k*(-ceiling(n/3^k) + floor(n/3^k))). - Daniel Hoying, Aug 06 2020