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

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A330581 a(0) = 2; thereafter a(n) = a(n - 1)^n + 1. 0

%I #41 Dec 10 2023 15:45:21

%S 2,3,10,1001,1004006004002,

%T 1020191144865623440455270145683555422808365843606721760320033

%N a(0) = 2; thereafter a(n) = a(n - 1)^n + 1.

%C Note that this could be extended backwards to a(-1), and any nonzero value x for a(-1) would work, since x^0 + 1 = 2.

%H David Johnson-Davies, <a href="http://www.lispology.com/show?2X07">Recursive functions without a base case</a>

%p a:= proc(n) option remember; `if`(n<0, %,

%p 1 + a(n-1)^n)

%p end:

%p seq(a(n), n=0..5); # _Alois P. Heinz_, Dec 18 2019

%t a[0] = 2; a[n_] := a[n] = a[n - 1]^n + 1; Array[a, 6, 0] (* _Amiram Eldar_, Dec 19 2019 *)

%t nxt[{n_,a_}]:={n+1,a^(n+1)+1}; NestList[nxt,{0,2},5][[;;,2]] (* _Harvey P. Dale_, Dec 10 2023 *)

%o (Lisp) (defun a (n) (+ (if (zerop n) 1 (expt (a (- n 1)) n)) 1))

%o (PARI) a(n) = if(n==0, 2, a(n-1)^n+1) \\ _Felix Fröhlich_, Dec 18 2019

%Y Cf. A000522, A182242.

%K nonn

%O 0,1

%A _David Johnson-Davies_, Dec 18 2019

%E Edited by _N. J. A. Sloane_, Dec 27 2019

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 April 25 04:42 EDT 2024. Contains 371964 sequences. (Running on oeis4.)