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 A257011 #10 May 20 2025 08:32:04 %S A257011 0,0,1,2,3,6,5,8,11,10,10,20,11,16,21,24,15,26,23,28,31,22,24,49,27, %T A257011 36,33,36,33,52,33,46,51,42,41,64,41,38,54,74,43,64,44,66,63,56,57,88, %U A257011 59,58,79,60,52,96,61,92,69,68,72,110 %N A257011 Number of sequences of positive integers with length 4 and alternant equal to n. %C A257011 See A257009 for the definition of the alternant of a sequence. The number of sequences of length 1 with given alternant value n is 1, while the number of sequences of length 2 with given alternant value n is d(n), the number of divisors of n (see A000005). %H A257011 B. R. Smith, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL17/Smith/smith5.html">Reducing quadratic forms by kneading sequences</a> J. Int. Seq., 17 (2014) 14.11.8. %e A257011 For n=5, the a(5)=3 sequences with alternant 5 and length 4 are (1,3,1,1), (1,2,2,1), and (1,1,3,1). %t A257011 Length4Q[x_, y_] := %t A257011 Module[{l = ContinuedFraction[(x[[2]] + 2*x[[1]] + y)/(2*x[[1]])]}, %t A257011 If[EvenQ[Length[l]], Return[Length[l] == 4], %t A257011 If[Last[l] == 1, Return[Length[l] - 1 == 4], Return[Length[l] + 1 == 4]]]]; %t A257011 Table[Length[ %t A257011 Select[Flatten[ %t A257011 Select[ %t A257011 Table[{a, k}, {k, %t A257011 Select[Range[Ceiling[-Sqrt[n^2 + 4]], Floor[Sqrt[n^2 + 4]]], %t A257011 Mod[# - n^2 - 4, 2] == 0 &]}, {a, %t A257011 Select[Divisors[(n^2 + 4 - k^2)/4], # > (Sqrt[n^2 + 4] - k)/2 &]}], %t A257011 UnsameQ[#, {}] &], 1], Length4Q[#, n] &]], {n, 1, 60}] %Y A257011 Cf. A257009, A257010, A257012, A257013, A000012, A000005 %K A257011 nonn %O A257011 1,4 %A A257011 _Barry R. Smith_, Apr 18 2015