login

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 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A007759
Knopfmacher expansion of sqrt(2): a(2n) = 2*(a(2n-1) + 1)^2 - 1, a(2n+1) = 2*(a(2n)^2 - 1).
2
2, 17, 576, 665857, 886731088896, 1572584048032918633353217, 4946041176255201878775086487573351061418968498176, 48926646634423881954586808839856694558492182258668537145547700898547222910968507268117381704646657
OFFSET
1,1
LINKS
A. Knopfmacher and J. Knopfmacher, An alternating product representation for real numbers, in Applications of Fibonacci numbers, Vol. 3 (Kluwer 1990), pp. 209-216.
MAPLE
a:= proc(n) option remember;
if n=1 then 2
elif `mod`(n, 2) = 0 then 2*(a(n-1) +1)^2 -1
else 2*(a(n-1)^2 -1)
end if; end proc;
seq(a(n), n = 1..9); # G. C. Greubel, Mar 04 2020
MATHEMATICA
a[n_]:= a[n]= If[n==1, 2, If[EvenQ[n], 2*(a[n-1] +1)^2 -1, 2*a[n-1]^2 -2]]; Table[a[n], {n, 9}] (* G. C. Greubel, Mar 04 2020 *)
PROG
(PARI) a(n) = if (n==1, 2, if (n % 2, 2*a(n-1)^2 - 2, 2*(a(n-1)+1)^2 - 1)); \\ Michel Marcus, Feb 20 2019
(Magma)
function a(n)
if n eq 1 then return 2;
elif n mod 2 eq 0 then return 2*(a(n-1) +1)^2 -1;
else return 2*(a(n-1)^2 -1);
end if; return a; end function;
[a(n): n in [1..9]]; // G. C. Greubel, Mar 04 2020
(Sage)
@CachedFunction
def a(n):
if (n==1): return 2
elif (n%2==0): return 2*(a(n-1) +1)^2 -1
else: return 2*(a(n-1)^2 -1)
[a(n) for n in (1..9)] # G. C. Greubel, Mar 04 2020
CROSSREFS
Cf. A002193 (sqrt(2)), A001601.
Sequence in context: A367829 A172341 A356502 * A062710 A012939 A013094
KEYWORD
nonn
EXTENSIONS
More terms from Christian G. Bower, Jan 06 2006
STATUS
approved