# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a354833 Showing 1-1 of 1 %I A354833 #36 Jul 02 2023 22:31:54 %S A354833 1,2,6,24,19,13,91,83,74,64,53,41,28,14,210,194,177,159,140,120,99,77, %T A354833 54,30,5,130,103,75,46,16,496,464,431,397,362,326,289,251,212,172,131, %U A354833 89,3827,3783,3738,3692,3645,3597,3548,3498,3447,3395,3342,3288,3233,3177 %N A354833 a(1)=1; for n > 1, a(n) = a(n-1) - n unless that result is already in the sequence or would be negative; otherwise, a(n) = a(n-1) * n. %H A354833 Rémy Sigrist, Table of n, a(n) for n = 1..22279 %e A354833 a(7) = 91 because from the previous term (13) you cannot subtract 7, because you would get 6, which is already in the sequence, so multiply 13 by 7 to get 91. %t A354833 a[1] = 1; a[n_] := a[n] = Module[{s = Array[a, n - 1], d}, If[(d = a[n - 1] - n) < 0 || MemberQ[s, d], n * a[n - 1], d]]; Array[a, 50] (* _Amiram Eldar_, Jun 07 2022 *) %o A354833 (PARI) { seen = Map(); v = 1; for (n=1, 56, mapput(seen, v, 0); print1 (v", "); v=if (mapisdefined(seen, w=v-(n+1)) || w<0, v*(n+1), w)) } \\ _Rémy Sigrist_, Jul 02 2022 %o A354833 (Python) %o A354833 from itertools import count, islice %o A354833 def agen(): %o A354833 an, seen = 1, {1} %o A354833 yield 1 %o A354833 for n in count(2): %o A354833 t = an - n %o A354833 an = t if t not in seen and t >= 0 else an*n %o A354833 yield an %o A354833 seen.add(an) %o A354833 print(list(islice(agen(), 56))) # _Michael S. Branicky_, Jul 02 2022 %Y A354833 Cf. A005132, A200044. %Y A354833 Cf. A355457 (Multiplicative steps). %K A354833 nonn %O A354833 1,2 %A A354833 _Kelvin Voskuijl_, Jun 07 2022 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE