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.

A213912 a(1) = 1; for n>1, a(n) = floor(sqrt(a(n-1))) if that number is not already in the sequence, otherwise a(n) = 3*a(n-1).

Original entry on oeis.org

1, 3, 9, 27, 5, 2, 6, 18, 4, 12, 36, 108, 10, 30, 90, 270, 16, 48, 144, 432, 20, 60, 7, 21, 63, 189, 13, 39, 117, 351, 1053, 32, 96, 288, 864, 29, 87, 261, 783, 2349, 7047, 83, 249, 15, 45, 135, 11, 33, 99, 297, 17, 51, 153, 459, 1377, 37, 111, 333, 999, 31
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 05 2013

Keywords

Comments

Permutation of natural numbers with inverse A213913.

Crossrefs

Cf. A114183.

Programs

  • Haskell
    a213912 n = a213912_list !! (n-1)
    a213912_list = 1 : f [1] where
       f xs@(x:_) = y : f (y : xs) where
         y = if z `notElem` xs then z else 3 * x where z = a000196 x
    
  • PARI
    lista(nn) = {my(k, v=vector(nn)); v[1]=1; for(n=2, nn, if(vecsearch(vecsort(v), k=sqrtint(v[n-1])), v[n]=3*v[n-1], v[n]=k)); v; } \\ Jinyuan Wang, Jun 26 2020