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.

A047904 a(n+1) = a(n) + n (if n is odd), a(n+1) = a(n) * n (if n is even).

Original entry on oeis.org

1, 2, 4, 7, 28, 33, 198, 205, 1640, 1649, 16490, 16501, 198012, 198025, 2772350, 2772365, 44357840, 44357857, 798441426, 798441445, 15968828900, 15968828921, 351314236262, 351314236285, 8431541670840, 8431541670865, 219220083442490
Offset: 1

Views

Author

Miklos SZABO (mike(AT)ludens.elte.hu)

Keywords

Crossrefs

Programs

  • Haskell
    a047904 n = a047904_list !! (n-1)
    a047904_list = 1 : zipWith uncurry
                               (cycle [(+), (*)]) (zip a047904_list [1..])
    -- Reinhard Zumkeller, Nov 13 2013, Mar 24 2013
  • Mathematica
    Transpose[NestList[{#[[1]]+1,If[OddQ[#[[1]]],Total[#],Times@@#]}&,{1,1},30]][[2]] (* Harvey P. Dale, Sep 11 2012 *)
  • Python
    a=1
    for n in range(1,33):
        print(a, end=", ")
        if n&1:
            a += n
        else:
            a *= n
    # Alex Ratushnyak, Feb 24 2013