login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 60th year, we have over 367,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Other ways to Give
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A077138 a(0) = 0. If n is odd, a(n) = a(n-1) + n, otherwise a(n) = a(n-1) * n. 9
0, 1, 2, 5, 20, 25, 150, 157, 1256, 1265, 12650, 12661, 151932, 151945, 2127230, 2127245, 34035920, 34035937, 612646866, 612646885, 12252937700, 12252937721, 269564629862, 269564629885, 6469551117240, 6469551117265, 168208329048890 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
William Boyles, Table of n, a(n) for n = 0..1000 [Terms 0 through 26 were computed by Amarnath Murthy; terms 27 through 1000 were computed by William Boyles, Nov 27 2016]
FORMULA
a(0) = 0, a(2n) = 2n*a(2n-1) and a(2n+1) = a(2n) +(2n +1).
MATHEMATICA
a = 0; Table[If[OddQ[n], a = n + a, a = n*a], {n, 0, 30}] (* T. D. Noe, Feb 26 2013 *)
nxt[{n_, a_}]:={n+1, If[EvenQ[n], a+n+1, a(n+1)]}; NestList[nxt, {0, 0}, 30][[All, 2]] (* Harvey P. Dale, Feb 13 2022 *)
PROG
(PARI) a(n)=if(n<0, 0, if(n%2, n+a(n-1), n*a(n-1)))
(Python)
a=0
for n in range(1, 33):
print(a, end=', ')
if n&1:
a += n
else:
a *= n
CROSSREFS
Sequence in context: A177494 A136900 A136898 * A247131 A192164 A244087
KEYWORD
nonn,easy
AUTHOR
Amarnath Murthy, Oct 30 2002
EXTENSIONS
Name improved by T. D. Noe, Feb 26 2013
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified December 2 19:49 EST 2023. Contains 367526 sequences. (Running on oeis4.)