This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A226166 #23 Jun 02 2025 06:50:42 %S A226166 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 A226166 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 A226166 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 A226166 One half of the length of the period of the principal indefinite quadratic binary form of discriminant D(n) = A079896(n). %C A226166 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 A226166 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=1, ..., 100, see a link under A225953. %C A226166 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 A226166 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 A226166 The irrational omega_p(D(n)) is from the interval (0, 1/2) if %C A226166 D and f(D) = ceiling(sqrt(D)) are of opposite parity, and from (1/2, 1) if they are of the same parity. %C A226166 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 A226166 D. A. Buell, Binary Quadratic Forms, Springer, 1989. %H A226166 Robin Visser, <a href="/A226166/b226166.txt">Table of n, a(n) for n = 1..10000</a> %F A226166 a(n) is one half of the (primitive) period length of the principal period of indefinite forms of discriminant D(n) = A079896(n), n >= 1. %F A226166 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 >= 1, 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 A226166 a(1) = 1 because for D(1) = 5 the principal period is [[1, 1, -1], [-1, 1, 1]], and its length is 2. %e A226166 a(1) = 1 because D(1) = 5, f(5) = 3, m(1)= 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(1). %e A226166 a(3) = 1 because for D(3) = 12 the principal period is [[1, 2, -2], [-2, 2, 1]], and its length is 2. %e A226166 a(3) = 1 because D(3) = 12, f(12) = 4, m(3)= 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(3) because [-1, 2, 2] is not an element of the principal period. %e A226166 a(5) = 3 from D(5) = 17, f(17) = 5, m(5)= 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(5). %e A226166 a(6) = 1 from D(6) = 20, f(20) = 5, m(6) = 5, omega_p(20) = (-4 + sqrt(20))/2 = -3*1 + 2*eta(5) (see the example a(1)). The r.c.f. is [0,period(4)] with period length 1 = a(6). %e A226166 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(6). %o A226166 (SageMath) %o A226166 def a(n): %o A226166 i, D = 1, Integer(5) %o A226166 while(i < n): %o A226166 D += 1; i += 1*(((D%4) in [0, 1]) and (not D.is_square())) %o A226166 Q = BinaryQF.principal(D).reduced_form() %o A226166 return len(Q.cycle(proper=True))/2 # _Robin Visser_, Jun 01 2025 %Y A226166 Cf. A079896, A225953. %K A226166 nonn %O A226166 1,5 %A A226166 _Wolfdieter Lang_, Jun 16 2013 %E A226166 Name changed and errors corrected by _Wolfdieter Lang_, Jun 16 2013 %E A226166 Offset corrected by _Robin Visser_, Jun 01 2025