OFFSET
1,3
COMMENTS
The sequence seems to grow between exponentially and factorially but that's just a suspicion.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..500
FORMULA
a(n) = lcm(a(n-1), n) - gcd(a(n-1), n) for n > 1.
EXAMPLE
For n = 5, since a(4) = 2, a(5) = lcm(5,2) - gcd(5,2) = 10 - 1 = 9.
MAPLE
a:= proc(n) option remember; `if`(n=1, 1,
ilcm(a(n-1), n)-igcd(a(n-1), n))
end:
seq(a(n), n=1..29); # Alois P. Heinz, Sep 17 2019
MATHEMATICA
a[1] = 1; a[n_] := a[n] = LCM[a[n - 1], n] - GCD[a[n - 1], n]; Array[a, 26] (* Amiram Eldar, Sep 17 2019 *)
nxt[{n_, a_}]:={n+1, LCM[a, n+1]-GCD[a, n+1]}; NestList[nxt, {1, 1}, 30][[All, 2]] (* Harvey P. Dale, Apr 05 2020 *)
PROG
(Python)
def lcmMinusGcd(n):
retlist = [1]
for i in range(1, n):
g = gcd(retlist[i-1], i+1)
retlist.append( floor(retlist[i-1]*(i+1) / g) - g)
return ', '.join(map(str, retlist))
(PARI) seq(n)={my(v=vector(n)); v[1]=1; for(n=2, #v, v[n] = lcm(v[n-1], n) - gcd(v[n-1], n)); v} \\ Andrew Howroyd, Aug 28 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Atticus Cull, Aug 13 2019
STATUS
approved