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.

A222208 a(1) = 1, a(2) = 3; for n>2, a(n) = smallest number not in {a(1), ..., a(n-1)} such that a(n) is divisible by a(d) for all divisors d of n.

Original entry on oeis.org

1, 3, 2, 6, 4, 12, 5, 18, 8, 24, 7, 36, 9, 15, 16, 54, 10, 48, 11, 72, 20, 21, 13, 108, 28, 27, 32, 30, 14, 96, 17, 162, 42, 60, 40, 144, 19, 33, 90, 216, 22, 120, 23, 84, 64, 39, 25, 324, 35, 168, 50, 270, 26, 192, 56, 180, 44, 126, 29, 288, 31, 51, 80, 486
Offset: 1

Views

Author

Alois P. Heinz, Feb 12 2013

Keywords

Comments

Permutation of the natural numbers A000027 with inverse permutation A222209.

Crossrefs

Programs

  • Haskell
    import Data.List (delete)
    a222208 n = a222208_list !! (n-1)
    a222208_list = 1 : 3 : f 3 (2 : [4 ..]) where
       f u vs = g vs where
         g (w:ws) = if all (== 0) $ map ((mod w) . a222208) $ a027751_row u
                       then w : f (u + 1) (delete w vs) else g ws
    -- Reinhard Zumkeller, Feb 13 2013
  • Maple
    b:= proc(n) false end:
    a:= proc(n) option remember; local h, i;
          if n<3 then h:= 2*n-1 else a(n-1); h:= ilcm(map(a,
             numtheory[divisors](n) minus {1, n})[]) fi;
          for i while b(i*h) do od;
          b(i*h):= true; i*h
        end:
    seq(a(n), n=1..100);
  • Mathematica
    a[1] = 1; a[2] = 3; a[n_] := a[n] = Module[{d, s, c, k}, d = Divisors[n] ~Complement~ {1, n}; For[s = Sort[Array[a, n-1]]; c = Complement[ Range[ Last[s]], s]; k = If[c == {}, Last[s]+1, First[c]], True, k++, If[FreeQ[s, k], If[AllTrue[d, Divisible[k, a[#]]&], Return[k]]]]];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jan 22 2017 *)