login
Least integer, k, greater than n such that t(k)*t(n) form a perfect square; t(i) is the i-th triangular number (A000217).
2

%I #23 Mar 13 2023 12:13:26

%S 1,8,24,48,80,120,168,224,49,360,440,528,624,728,840,960,1088,1224,

%T 1368,1520,1680,1848,2024,2208,242,2600,2808,3024,3248,3480,3720,3968,

%U 4224,4488,4760,5040,5328,5624,5928,6240,6560,6888,7224,7568,7920,8280,8648

%N Least integer, k, greater than n such that t(k)*t(n) form a perfect square; t(i) is the i-th triangular number (A000217).

%C It appears that a(n) = A033996(n) for most n. - _Robert Israel_, Feb 15 2019

%H Robert Israel, <a href="/A179682/b179682.txt">Table of n, a(n) for n = 0..2000</a>

%F From _Robert Israel_, Feb 15 2019: (Start)

%F a(n) <= A033996(n).

%F If n = A033996(j) then a(n) <= A033996(a(j)).

%F If n = a(j) < A033996(j) then a(n) <= A033996(j).

%F (End)

%p f:= proc(n) local F,t,p,k0,d,k,a,j;

%p p:= max(map(t -> `if`(t[2]::odd, t[1],NULL), [op(ifactors(n)[2]),op(ifactors(n+1)[2])]));

%p if n mod p = 0 then k0:= n+p-1; d:= 1;

%p else k0:= n+1; d:= p-1;

%p fi;

%p t:= n*(n+1)/4;

%p for a from k0 by p do

%p for k in [a, a+d] do

%p if issqr(k*(k+1)*t) then return k fi

%p od od

%p end proc:

%p f(0):= 1:

%p map(f, [$0..100]); # _Robert Israel_, Feb 15 2019

%t f[n_] := Block[{k = n + 1, n2 = n (n + 1)/2}, While[ !IntegerQ@ Sqrt[n2*k (k + 1)/2], k++ ]; k]; Array[f, 47, 0]

%o (Python)

%o from sympy.ntheory.primetest import is_square

%o def A179682(n):

%o m = n*(n+1)>>1

%o k = n+1

%o while not is_square(m*k*(k+1)>>1):

%o k += 1

%o return k # _Chai Wah Wu_, Mar 13 2023

%Y Cf. A000217, A033996, A175497, A306415.

%K nonn,look

%O 0,2

%A _Robert G. Wilson v_, Jul 24 2010

%E Incorrect empirical g.f. removed by _Robert Israel_, Feb 15 2019