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

This page as a plain text file.
%I A047905 #34 Feb 19 2024 01:55:07
%S A047905 1,1,3,9,13,65,71,497,505,4545,4555,50105,50117,651521,651535,9773025,
%T A047905 9773041,166141697,166141715,3156692585,3156692605,66290544705,
%U A047905 66290544727,1524682528721,1524682528745,38117063218625,38117063218651
%N A047905 a(n+1) = a(n) + n (if n is even), a(n+1) = a(n) * n (if n is odd).
%H A047905 Reinhard Zumkeller, <a href="/A047905/b047905.txt">Table of n, a(n) for n = 1..100</a>
%t A047905 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 *)
%t A047905 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 *)
%o A047905 (Haskell)
%o A047905 a047905 n = a047905_list !! (n-1)
%o A047905 a047905_list = 1 : zipWith uncurry
%o A047905                            (cycle [(*), (+)]) (zip a047905_list [1..])
%o A047905 -- _Reinhard Zumkeller_, Nov 13 2013, May 31 2011
%o A047905 (Python)
%o A047905 a=1
%o A047905 for n in range(1,33):
%o A047905     print(a, end=", ")
%o A047905     if n&1:
%o A047905         a *= n
%o A047905     else:
%o A047905         a += n
%o A047905 # _Alex Ratushnyak_, Feb 24 2013
%Y A047905 Cf. A000124, A047904, A077138.
%K A047905 nonn,easy,nice
%O A047905 1,3
%A A047905 Miklos SZABO (mike(AT)ludens.elte.hu)