OFFSET
1,2
COMMENTS
LINKS
R. J. Mathar, Table of n, a(n) for n = 1..20000.
FORMULA
a(n) = 0 iff n is a square (A000290). - Robert G. Wilson v, Apr 11 2017
EXAMPLE
a(2) = 2 because continued fraction of (1+sqrt(2))/2 = 1, 4, 1, 4, 1, 4, 1, ... has period (1,4) length 2.
MAPLE
A146326 := proc(n) if not issqr(n) then numtheory[cfrac]( (1+sqrt(n))/2, 'periodic', 'quotients') ; nops(%[2]) ; else 0 ; fi; end: seq(A146326(n), n=1..100) ; # R. J. Mathar, Sep 06 2009
MATHEMATICA
Table[cf = ContinuedFraction[(1 + Sqrt[n])/2]; If[Head[cf[[-1]]] === List, Length[cf[[-1]]], 0], {n, 100}]
f[n_] := Length@ ContinuedFraction[(1 + Sqrt[n])/2][[-1]]; Array[f, 100] (* Robert G. Wilson v, Apr 11 2017 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Artur Jasinski, Oct 30 2008
EXTENSIONS
a(39) and a(68) corrected by R. J. Mathar, Sep 06 2009
STATUS
approved