login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A047905 a(n+1) = a(n) + n (if n is even), a(n+1) = a(n) * n (if n is odd). 8
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,3

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 1..100

MAPLE

A047905:=proc(q)

local a, n; a:=1; print(a);

for n from 2 to q do

  a:=1/2*((n-1+a)*(1-(-1)^n)+a*(n-1)*(1+(-1)^n)); print(a);

od; end:

A047905(1000); # Paolo P. Lava, Feb 19 2013

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 *)

PROG

(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

(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

CROSSREFS

Cf. A000124, A047904, A077138.

Sequence in context: A089147 A094043 A134190 * A134904 A310324 A092476

Adjacent sequences:  A047902 A047903 A047904 * A047906 A047907 A047908

KEYWORD

nonn,easy,nice,changed

AUTHOR

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

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 29 03:57 EDT 2021. Contains 346340 sequences. (Running on oeis4.)