A257010 Number of sequences of positive integers with length 3 and alternant equal to n.
0, 2, 2, 4, 3, 6, 2, 9, 4, 6, 5, 11, 4, 9, 6, 10, 5, 14, 2, 16, 7, 6, 9, 16, 6, 11, 8, 17, 5, 14, 4, 20, 10, 8, 9, 22, 2, 17, 10, 16, 11, 14, 6, 18, 13, 12, 5, 28, 6, 19, 9, 15, 13, 16, 8, 24, 6, 12, 11, 32, 6, 15, 16, 16, 9, 19, 8, 30, 8, 14, 9, 30, 8, 15, 12, 21, 16, 22
Offset: 3
Keywords
Examples
For n=6, the a(6) = 4 sequences with alternant 6 are (1,1,3), (1,3,2), (2,3,1), (3,1,1)
Links
- Andrew Howroyd, Table of n, a(n) for n = 3..1000
- B. R. Smith, Reducing quadratic forms by kneading sequences J. Int. Seq., 17 (2014) 14.11.8.
Programs
-
Maple
Dbm:= proc(b,m) nops(select(t -> (t-1) mod b = 0, numtheory:-divisors(m))) end proc: seq(add(Dbm(b,b^2+n*b+1)-2, b=1..n-1), n=3..100); # Robert Israel, Jan 24 2016
-
Mathematica
Length3Q[x_, y_] := Module[{l = ContinuedFraction[(x[[2]] + 2*x[[1]] + y)/(2*x[[1]])]}, If[OddQ[Length[l]], Return[Length[l] == 3], If[Last[l] == 1, Return[Length[l] - 1 == 3], Return[Length[l] + 1 == 3]]]]; 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], Length3Q[#, n] &]], {n, 3, 60}]
-
PARI
a(n)={sum(b=1, n-1, sumdiv(b^2+n*b+1, d, (d-1)%b==0) - 2)} \\ Andrew Howroyd, May 01 2020
Formula
a(n) = Sum_{b=1..n-1} (Dbm (b,b^2+nb+1)-2), where Dbm(b,m) is the number of positive divisors of m that are congruent to 1 modulo b. - Barry R. Smith, Jan 24 2016
Extensions
Terms a(61) and beyond from Andrew Howroyd, May 01 2020
Comments