%I #11 Oct 19 2017 03:14:21
%S 0,0,2,2,0,4,4,5,4,0,6,6,6,10,8,6,0,8,8,10,8,10,12,11,8,0,10,10,12,16,
%T 10,17,11,12,14,10,0,12,12,12,12,16,12,16,16,16,26,17,12,0,14,14,16,
%U 22,16,16,14,16,20,18,16,36,20,14,0,16,16,22,16,26,18,27,16,30,20,17,26,22
%N a(n) is the period of the imaginary continued fraction expansion of sqrt(-n).
%C Numbers n for which a(n) is odd seem to be a subset of numbers n for which A003285(n) is a multiple of 4. - _Thomas Baruchel_, Jul 03 2007
%e a(7) = 5 because sqrt(-7) = [2i, -2i, {-3i, -2i, -2i, -2i, -3i},...].
%o (PARI) complex_period(n)= { local(a,b,c,d,k,oa,oc,i,s); s=sqrtint(n); if(issquare(c=n),0, until(c==oc, oc=c; oa=a; if((a = (n-b^2)/c) == oa,return(2*i)); i += (k = (s-b)\a); d = a*k+b; c = (n-d^2)/a; b = (s+d)%c-s); 2*i-k); }
%Y Cf. A003285.
%K easy,nonn
%O 0,3
%A _Thomas Baruchel_, Aug 22 2003
%E Edited by _Don Reble_, Jul 31 2006