login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A217585 Number of triangles with endpoints of the form (x,x^2), x in {-n,...,n}, having at least one angle of 45 degrees. 1

%I #24 Oct 10 2022 07:56:24

%S 0,1,5,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83,87,91,

%T 95,99,103,107,111,115,119,123,127,131,135,139,143,147,151,155,159,

%U 163,167,171,175,179,183,187,191,195,199,203,207,211,215,219,223,227,231,235,239,243,247

%N Number of triangles with endpoints of the form (x,x^2), x in {-n,...,n}, having at least one angle of 45 degrees.

%H Project Euler, <a href="https://projecteuler.net/problem=397">Problem 397: Triangle on parabola</a>, Oct 07 2012.

%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (2,-1).

%F a(n) = 4n-1 for n > 2.

%F From _Colin Barker_, Sep 20 2014: (Start)

%F a(n) = 2*a(n-1) - a(n-2) for n > 4.

%F G.f.: -x*(2*x^3 - 2*x^2 - 3*x - 1) / (x-1)^2. (End)

%e For n=1, there is one such triangle, having its points at abscissas [a,b,c] = [-1,0,1].

%e 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].

%e 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.

%o (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}

%o (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

%K nonn,easy

%O 0,3

%A _M. F. Hasler_, Oct 07 2012

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 2 16:14 EDT 2024. Contains 372197 sequences. (Running on oeis4.)