login
A362698
For n > 1, if n appears in the sequence, a(n) = a(n-1) - n if nonnegative and not already in the sequence, otherwise a(n) = a(n-1) + n. Otherwise a(n+1) = a(n)/(n+1) if (n+1)|a(n), otherwise a(n)*(n+1), a(1) = 1 and a(2) = 1*2.
1
1, 2, 6, 24, 120, 114, 798, 6384, 57456, 574560, 6320160, 526680, 6846840, 489060, 32604, 521664, 8868288, 159629184, 8401536, 168030720, 3528645120, 160392960, 3689038080, 3689038056, 92225951400, 2397874736400, 64742617882800, 1812793300718400, 52571005720833600
OFFSET
1,2
LINKS
Michael De Vlieger, Log log scatterplot of log_10 a(n), n = 2..2^18.
EXAMPLE
a(2) = 2, as a(1) = 1 and 1 times 2 is 2.
a(6) = 114, as a(3) = 6 = n, thus a(6) = a(5) - 6 = 114.
a(7) = 798, as a(6) = 114 and 7 times 114 is 798.
MATHEMATICA
nn = 120; c[_] := False; Array[Set[{a[#], c[#]}, {#, True}] &, 2]; j = 2; Do[k = If[c[n], If[And[! c[#], # >= 0], #, j + n] &[j - n], If[Divisible[j, n], j/n, j n]]; Set[{a[n], c[k], j}, {k, True, k}], {n, 3, nn}]; Array[a, nn] (* Michael De Vlieger, Aug 30 2023 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Kelvin Voskuijl, Jul 07 2023
EXTENSIONS
More terms from Michael De Vlieger, Aug 30 2023
STATUS
approved