login
Numbers n >= 0 such that n^2 + n*(n+1)/2 is a square.
4

%I #42 Nov 01 2022 17:03:34

%S 0,8,800,78408,7683200,752875208,73774087200,7229107670408,

%T 708378777612800,69413891098384008,6801852948864020000,

%U 666512175097575576008,65311391306613542428800,6399849835873029582446408,627119972524250285537319200

%N Numbers n >= 0 such that n^2 + n*(n+1)/2 is a square.

%C Equivalently, numbers n such that triangular(2*n) - triangular(n) is a square.

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

%F a(n) = A098308(2*n-2).

%F a(1) = 0, a(2) = 8, a(3) = 800 and a(n) = 99*a(n-1)-99*a(n-2)+a(n-3) for n>3. - _Giovanni Resta_, Apr 12 2013

%F G.f.: -8*x^2*(x+1) / ((x-1)*(x^2-98*x+1)). - _Colin Barker_, May 31 2013

%F a(n) = (49+20*sqrt(6))^(-n)*(49+20*sqrt(6)-2*(49+20*sqrt(6))^n+(49-20*sqrt(6))*(49+20*sqrt(6))^(2*n))/12. - _Colin Barker_, Mar 05 2016

%F a(n) = 8*A108741(n). - _R. J. Mathar_, Feb 19 2017

%t a[n_]:=Floor[(1/12)*(49 + 20*Sqrt[6])^n]; Table[a[n],{n,0,10}] (* _Giovanni Resta_, Apr 12 2013 *)

%t LinearRecurrence[{99,-99,1},{0,8,800},20] (* _Harvey P. Dale_, Nov 01 2022 *)

%o (C)

%o #include <stdio.h>

%o #include <math.h>

%o int main() {

%o unsigned long long a, i, t;

%o for (i=0; i < (1L<<32); ++i) {

%o a = (i*i) + ((i+1)*i/2);

%o t = sqrt(a);

%o if (a == t*t) printf("%llu\n", i);

%o }

%o return 0;

%o }

%o (PARI) lista(nn) = for(n=0, nn, if(issquare(n^2 + n*(n+1)/2), print1(n, ", "))); \\ _Altug Alkan_, Mar 05 2016

%Y Cf. A005449 (n^2 + n(n+1)/2).

%Y Cf. A011916 (numbers n such that n^2 + n(n+1)/2 is a triangular number).

%Y Cf. A014105 (n^2 + n(n+1)).

%Y Cf. A084703 (numbers n such that n^2 + n(n+1) is a square).

%Y Cf. A220185 (numbers n such that n^2 + n(n+1) is an oblong number).

%K nonn,easy

%O 1,2

%A _Alex Ratushnyak_, Apr 12 2013