OFFSET
3,1
COMMENTS
Note that (n+(n+1)+(n+2)+...+(n+k))/(n+k+1) = A332544(n)/(n+k+1) = A082183(n-1). See the Myers et al. link for proof. - N. J. A. Sloane, Apr 30 2020
We can always take k = n^2-2*n-1, for then the sum in the definition becomes (n+1)*n*(n-1)*(n-2)/2, which is an integral multiple of n+k+1 = n*(n-1). So a(n) always exists. - N. J. A. Sloane, Feb 20 2020
LINKS
Seiichi Manyama, Table of n, a(n) for n = 3..10000
J. S. Myers, R. Schroeppel, S. R. Shannon, N. J. A. Sloane, and P. Zimmermann, Three Cousins of Recaman's Sequence, arXiv:2004:14000 [math.NT], 2020-2021.
EXAMPLE
MAPLE
grow2 := proc(n, M) local p, q, k; # searches out to a limit of M
# returns n, k (A332542(n)), n+k+1 (A332543(n)), p (A332544(n)), and q (which appears to match A082183(n-1))
for k from 1 to M do
if ((k+1)*n + k*(k+1)/2) mod (n+k+1) = 0 then
p := (k+1)*n+k*(k+1)/2;
q := p/(n+k+1); return([n, k, n+k+1, p, q]);
fi;
od:
# if no success, return -1's
[n, -1, -1, -1, -1]; end; # N. J. A. Sloane, Feb 18 2020
MATHEMATICA
a[n_] := NestWhile[#1+1&, 0, !IntegerQ[Divide[(#+1)*n+#*(#+1)/2, n+#+1]]&]
a/@Range[3, 100] (* Bradley Klee, Apr 30 2020 *)
PROG
(Ruby)
def A(n)
s = n
t = n + 1
while s % t > 0
s += t
t += 1
end
t - n - 1
end
def A332542(n)
(3..n).map{|i| A(i)}
end
p A332542(100) # Seiichi Manyama, Feb 19 2020
(PARI) a(n) = my(k=1); while (sum(i=0, k, n+i) % (n+k+1), k++); k; \\ Michel Marcus, Aug 26 2021
(Python)
def a(n):
k, s = 1, 2*n+1
while s%(n+k+1) != 0: k += 1; s += n+k
return k
print([a(n) for n in range(3, 67)]) # Michael S. Branicky, Aug 26 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Feb 18 2020
STATUS
approved