OFFSET
0,3
LINKS
Project Euler, Problem 397: Triangle on parabola, Oct 07 2012.
Index entries for linear recurrences with constant coefficients, signature (2,-1).
FORMULA
a(n) = 4n-1 for n > 2.
From Colin Barker, Sep 20 2014: (Start)
a(n) = 2*a(n-1) - a(n-2) for n > 4.
G.f.: -x*(2*x^3 - 2*x^2 - 3*x - 1) / (x-1)^2. (End)
EXAMPLE
For n=1, there is one such triangle, having its points at abscissas [a,b,c] = [-1,0,1].
For n=2, there are 4 more such triangles, with [a,b,c] = [-2, 1, 2], [-2, -1, 2], [-1, 1, 2] and [-2, -1, 1].
For n=3, there are 6 more such triangles, namely [a,b,c] = [-3, 0, 2]*, [-3, 2, 3], [-2, 2, 3] and the symmetric of these. The first one (marked *) is the first instance where the 45-degree angle is at the bottom and not on the left or right as for all others so far.
PROG
(PARI) A217585(n, dump=0)={my(c=0, C=180/45/Pi, S=100+n^2); forvec(v=vector(3, i, [if(i<2, -n), if(i>1, n)]), bestappr(abs(atan(v[2]+v[1])-atan(v[3]+v[1]))*C, S)==1 &c++ &!(dump&print1(v", ")) &(v[2]||c-=1/2) &next; bestappr(abs(atan(1/(v[2]-v[1]))+atan(1/(v[2]+v[3])))*C, S)==1 &c++ &!(dump&print1(v"*, ")) &(v[2]||c-=1/2) &next, 2); c*2}
(PARI) concat(0, Vec(-x*(2*x^3-2*x^2-3*x-1)/(x-1)^2 + O(x^100))) \\ Colin Barker, Sep 20 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
M. F. Hasler, Oct 07 2012
STATUS
approved