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.

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

Original entry on oeis.org

1, 1, 3, 9, 13, 65, 71, 497, 505, 4545, 4555, 50105, 50117, 651521, 651535, 9773025, 9773041, 166141697, 166141715, 3156692585, 3156692605, 66290544705, 66290544727, 1524682528721, 1524682528745, 38117063218625, 38117063218651
Offset: 1

Views

Author

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

Keywords

Crossrefs

Programs

  • Haskell
    a047905 n = a047905_list !! (n-1)
    a047905_list = 1 : zipWith uncurry
                               (cycle [(*), (+)]) (zip a047905_list [1..])
    -- Reinhard Zumkeller, Nov 13 2013, May 31 2011
    
  • Mathematica
    a[0]=1;a[n_]:=a[n]=If[EvenQ[n],a[n-1]+n,a[n-1]n];Join[{1}, Array[a,40]] (* Harvey P. Dale, Apr 24 2011 *)
    nxt[{n_,a_}]:={n+1,If[EvenQ[n],a+n,a*n]}; NestList[nxt,{1,1},30][[All,2]] (* Harvey P. Dale, Jul 27 2021 *)
  • 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