OFFSET
1,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = floor(sqrt(a(n-1)^2 + a(n-2)^2)) with a(1)=1, a(2)=3.
MATHEMATICA
a[n_]:= a[n]= If[n<3, 2*n-1, Floor[Sqrt[a[n-1]^2 +a[n-2]^2]]]; Table[a[n], {n, 50}] (* Robert G. Wilson v, Mar 28 2005 *)
nxt[{a_, b_}]:={b, Floor[Sqrt[a^2+b^2]]}; Transpose[NestList[nxt, {1, 3}, 50]] [[1]] (* Harvey P. Dale, Oct 29 2012 *)
PROG
(Magma)
A104803:= func< n| n lt 3 select (2*n-1) else Floor(Sqrt(Self(n-1)^2 +Self(n-2)^2)) >;
[A104803(n): n in [1..60]]; // G. C. Greubel, Jun 27 2021
(Sage)
@CachedFunction
def a(n): return (2*n-1) if (n<3) else floor(sqrt(a(n-1)^2 + a(n-2)^2))
[a(n) for n in (1..60)] # G. C. Greubel, Jun 27 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Mar 26 2005
EXTENSIONS
More terms from Robert G. Wilson v, Mar 28 2005
STATUS
approved