login
Numbers n such that n^2 + n(n+1) is an oblong number (A002378).
5

%I #38 Sep 08 2022 08:46:04

%S 0,10,348,11830,401880,13652098,463769460,15754509550,535189555248,

%T 18180690368890,617608282987020,20980500931189798,712719423377466120,

%U 24211479893902658290,822477596969312915748,27940026817062736477150,949138434183163727307360

%N Numbers n such that n^2 + n(n+1) is an oblong number (A002378).

%C Also numbers n such that the sum of the hexagonal numbers H(n) and H(n+1) is equal to m^2 + (m+1)^2 for some m. - _Colin Barker_, Dec 10 2014

%C Also nonnegative integers x in the solutions to 4*x^2-2*y^2+2*x-2*y = 0, the corresponding values of y being A251867. - _Colin Barker_, Dec 10 2014

%H Colin Barker, <a href="/A220185/b220185.txt">Table of n, a(n) for n = 1..654</a>

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

%F For n>1, a(n) = A089928(n*4-5).

%F From _Bruno Berselli_, Apr 12 2013: (Start)

%F G.f.: 2*x^2*(5-x)/((1-x)*(1-34*x+x^2)).

%F a(n) = ((1+sqrt(2))^(4n-3)+(1-sqrt(2))^(4n-3)-2)/8.

%F a(n+2) = 10*A029546(n)-2*A029546(n-1). (End)

%F a(n) = 35*a(n-1)-35*a(n-2)+a(n-3). - _Colin Barker_, Dec 10 2014

%F a(n) = A251867(n) - A001542(n-1)^2. - _Alexander Samokrutov_, Sep 05 2015

%e a(3) = A089928(7) = 348.

%p f:= gfun:-rectoproc({a(n)=35*(a(n-1)-a(n-2))+a(n-3),a(1)=0,a(2)=10,a(3)=348},a(n),remember):

%p map(f, [$1..50]); # _Robert Israel_, Sep 06 2015

%t LinearRecurrence[{35, - 35, 1}, {0, 10, 348}, 20] (* _Vincenzo Librandi_, Sep 06 2015 *)

%o (C)

%o #include <stdio.h>

%o #include <math.h>

%o typedef unsigned long long U64;

%o U64 rootPronic(U64 a) {

%o U64 sr = 1L<<31, s, b;

%o if (a < sr*(sr+1)) {

%o sr>>=1;

%o while (a < sr*(sr+1)) sr>>=1;

%o }

%o for (b = sr>>1; b; b>>=1) {

%o s = sr+b;

%o if (a >= s*(s+1)) sr = s;

%o }

%o return sr;

%o }

%o int main() {

%o U64 a, n, r, t;

%o for (n=0; n < (1L<<31); n++) {

%o a = (n*(n+1)) + n*n;

%o t = rootPronic(a);

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

%o }

%o }

%o (PARI) concat(0, Vec(2*x^2*(5-x)/((1-x)*(1-34*x+x^2))+O(x^100))) \\ _Colin Barker_, Dec 10 2014

%o (Magma) [Floor(((1+Sqrt(2))^(4*n-3)+(1-Sqrt(2))^(4*n-3)-2)/8): n in [1..20]]; // _Vincenzo Librandi_, Sep 08 2015

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

%Y Cf. A000290, A000384, A251867.

%K nonn,easy

%O 1,2

%A _Alex Ratushnyak_, Apr 12 2013

%E More terms from _Bruno Berselli_, Apr 12 2013