%I
%S 1,1,1,1,3,1,1,1,2,1,1,2,3,1,5,1,1,1,5,1,2,3,1,3,3,1,2,1,9,3,1,1,3,1,
%T 3,7,2,1,1,9,3,1,3,1,7,2,7,5,1,1,4,1,2,5,2,2,2,7,1,2,3,1,5,1,4,1,5,1,
%U 5,3,1,1,5,1,4,6,3,5,6,3,2,2,1,15,3,1,7,1,2,3,6,5,2,3,8,2,1,1
%N One half of the length of the period of the principal indefinite quadratic binary form of discriminant D(n) = A079896(n).
%C The principal indefinite binary quadratic form F_p of discriminant D is [1, b(D), c(D)] with c(D) = (D  b(D)^2)/4 and, using f(D) := ceiling(sqrt(D)), b(D) = f(D)  2 if D and f(D) have the same parity, and b(D) = f(D)  1 if D and f(D) have opposite parity. For the possible D values see A079896.
%C For example, D = 5, f(D) = 3, F_p(5) = [1, 1, 1]; D = 28, f(D) = 6, [1, 4, 3]; D = 20, f(D) = 5, [1, 4, 1]; D = 13, f(D) = 4, [1, 3 ,1]. For the definition of the principal form see the Buell reference, p. 26. The period (called cycle by Buell) starting with this principal form (which is reduced) is the principal period, and the length of this period is 2*a(n) for D = D(n) = A079896(n). For all periods for D(n), n=0, ..., 99, see a link under A225953.
%C The quadratic irrational number belonging to the principal indefinite form F_p = [1, b(D), c(D)] from above is defined as omega_p(D) := (b(D) + sqrt(D))/2 (see the general definition by Buell on p.31). This is a solution of x^2 + b(D)*x + c(D) = 0. This irrational omega_p(D) has a periodic regular continued fraction (r.c.f) with primitive period length a(n) if the form [1, b(D), c(D)] appears in the principal period. Otherwise the primitive period length of this r.c.f. is 2*a(n).
%C For the connection between the principal period (or cycle) of indefinite forms of discriminant D and the continued fraction expansion of omega_p(D) see the Buell reference, ch. 3.
%C The irrational omega_p(D(n)) is from the interval (0, 1/2) if
%C D and f(D) = ceiling(sqrt(D)) are of opposite parity, and from (1/2, 1) if they are of the same parity.
%C The irrational omega_p(D(n)) is an integer in the real quadratic field Q(sqrt(m(n))) with m(n) := squarefree part of D(n).
%D D. A. Buell, Binary Quadratic Forms, Springer, 1989.
%F a(n) is one half of the (primitive) period length of the principal period of indefinite forms of discriminant D(n) = A079896(n), n >= 0.
%F a(n) is the (primitive) period length of the regular continued fraction (r.c.f.) of the quadratic irrational omega_p(D(n)) defined above for discriminant D(n) = A079896(n), n >= 0, if the form [1, b(D), c(D)] appears in the principal period. See the comment section for b(D) and c(D). Otherwise this r.c.f. has period length 2*a(n).
%e a(0) = 1 because for D(1) = 5 the principal period is [[1, 1, 1], [1, 1, 1]], and its length is 2.
%e a(0) = 1 because D(1) = 5, f(5) = 3, m(0)= 5, omega_p(5) = (1 + sqrt(5))/2 = 1*1 + 1*eta(5), with eta(5) := (1 + sqrt(5))/2 (golden section), in the basis <1, eta(5)> for integers of Q(sqrt(5)) = Q(eta(5)). The regular continued fraction (r.c.f) is omega_p(5) = [0, period(1)], with period length 1 = a(0).
%e a(2) = 1 because for D(2) = 12 the principal period is [[1, 2, 2], [2, 2, 1]], and its length is 2.
%e a(2) = 1 because D(2) = 12, f(12) = 4, m(2)= 3, omega_p(12) = 1 + sqrt(3), an integer of Q(sqrt(3)). Its regular continued fraction is [0, period(1,2)], with period length 2 = 2*a(2) because [1, 2, 2] is not an element of the principal period.
%e a(4) = 3 from D(4) = 17, f(17) = 5, m(4)= 17, omega_p(17) = (3 + sqrt(17))/2 = 2*1 + 1*eta(17), with eta(17) :=(1+sqrt(17))/2. This is an integer in Q(sqrt(17)), and the r.c.f. is omega_p(17) = [0,period(1,1,3)] with period length 3 = a(4).
%e a(5) = 1 from D(5) = 20, f(20) = 5, m(5) = 5, omega_p(20) = (4 + sqrt(20))/2 = 3*1 + 2*eta(5) (see the example a(0)). The r.c.f. is [0,period(4)] with period length 1 = a(5).
%e The principal period (cycle) for D = 20 is [[1, 4, 1], [1, 4, 1]] (the only period, see a link under A225953). The length of the period is 2 = 2*a(5).
%Y Cf. A079896, A225953.
%K nonn
%O 0,5
%A _Wolfdieter Lang_, Jun 16 2013
%E Name changed and errors corrected by _Wolfdieter Lang_, Jun 16 2013
