OFFSET
1,1
COMMENTS
This is a multiplicative analog of A332542.
a(n) always exists because one can take k to be 2^m - 1 for m large.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
David A. Corneth, PARI program
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], April 2020.
FORMULA
a(n) = A061836(n) - 1 for n >= 1.
a(n + 1) >= a(n) - 1. a(n + 1) = a(n) - 1 mostly. - David A. Corneth, Apr 14 2020
MAPLE
f:= proc(n) local k, p;
p:= n;
for k from 1 do
p:= p*(n+k);
if (p/(n+k+1))::integer then return k fi
od
end proc:
map(f, [$1..100]); # Robert Israel, Feb 25 2020
MATHEMATICA
a[n_] := Module[{k, p = n}, For[k = 1, True, k++, p *= (n+k); If[Divisible[p, n+k+1], Return[k]]]];
Array[a, 100] (* Jean-François Alcover, Jun 04 2020, after Maple *)
PROG
(PARI) a(n) = {my(r=n*(n+1)); for(k=2, oo, r=r*(n+k); if(r%(n+k+1)==0, return(k))); } \\ Jinyuan Wang, Feb 25 2020
(PARI) \\ See Corneth link
(Python)
def a(n):
k, p = 1, n*(n+1)
while p%(n+k+1): k += 1; p *= (n+k)
return k
print([a(n) for n in range(1, 85)]) # Michael S. Branicky, Jun 06 2021
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Scott R. Shannon and N. J. A. Sloane, Feb 24 2020
STATUS
approved