OFFSET
0,2
COMMENTS
It appears that a(n) = A033996(n) for most n. - Robert Israel, Feb 15 2019
LINKS
Robert Israel, Table of n, a(n) for n = 0..2000
FORMULA
MAPLE
f:= proc(n) local F, t, p, k0, d, k, a, j;
p:= max(map(t -> `if`(t[2]::odd, t[1], NULL), [op(ifactors(n)[2]), op(ifactors(n+1)[2])]));
if n mod p = 0 then k0:= n+p-1; d:= 1;
else k0:= n+1; d:= p-1;
fi;
t:= n*(n+1)/4;
for a from k0 by p do
for k in [a, a+d] do
if issqr(k*(k+1)*t) then return k fi
od od
end proc:
f(0):= 1:
map(f, [$0..100]); # Robert Israel, Feb 15 2019
MATHEMATICA
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]
PROG
(Python)
from sympy.ntheory.primetest import is_square
def A179682(n):
m = n*(n+1)>>1
k = n+1
while not is_square(m*k*(k+1)>>1):
k += 1
return k # Chai Wah Wu, Mar 13 2023
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Robert G. Wilson v, Jul 24 2010
EXTENSIONS
Incorrect empirical g.f. removed by Robert Israel, Feb 15 2019
STATUS
approved