A257012 Number of sequences of positive integers with length 5 and alternant equal to n.
0, 0, 1, 2, 3, 5, 5, 10, 8, 11, 11, 19, 15, 19, 17, 27, 17, 36, 17, 43, 27, 29, 31, 54, 30, 41, 45, 63, 29, 57, 33, 75, 49, 59, 47, 96, 39, 79, 57, 84, 61, 81, 49, 97, 81, 85, 47, 150, 64, 105, 75, 101, 69, 123, 77, 141, 81, 103, 71, 189, 75, 119, 121, 137, 82, 143, 85, 183, 101, 129, 93, 211, 89, 129, 131, 187, 116, 201
Offset: 1
Keywords
Examples
The a(7) = 3 sequences with length 5 and alternant 7 are (1,1,1,3,1), (1,2,1,2,1), and (1,3,1,1,1).
Links
- B. R. Smith, Reducing quadratic forms by kneading sequences J. Int. Seq., 17 (2014) 14.11.8.
Programs
-
Mathematica
Length5Q[x_, y_] := Module[{l = ContinuedFraction[(x[[2]] + 2*x[[1]] + y)/(2*x[[1]])]}, If[OddQ[Length[l]], Return[Length[l] == 5], If[Last[l] == 1, Return[Length[l] - 1 == 5], Return[Length[l] + 1 == 5]]]]; Table[Length[ Select[Flatten[ Select[ Table[{a, k}, {k, Select[Range[Ceiling[-Sqrt[n^2 - 4]], Floor[Sqrt[n^2 - 4]]], Mod[# - n^2 + 4, 2] == 0 &]}, {a, Select[Divisors[(n^2 - 4 - k^2)/4], # > (Sqrt[n^2 - 4] - k)/2 &]}], UnsameQ[#, {}] &], 1], Length5Q[#, n] &]], {n, 3, 80}]
Comments