This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A371295 #16 Mar 19 2024 08:32:15 %S A371295 2,3,-1,4,-17,5,-11,6,-16,7,-49,9,-54,8,-62,10,-89,12,-120,13,-143,14, %T A371295 -168,15,-194,18,-271,19,-305,20,-341,21,-378,22,-440,23,-483,24,-527, %U A371295 25,-599,26,-649,27,-701,28,-755,29,-811,30,-869,31,-929,32,-991,33 %N A371295 Value k at the n-th step of A371282, where multiplied values are positive and subtracted values are negative. %H A371295 Michael S. Branicky, <a href="/A371295/b371295.txt">Table of n, a(n) for n = 1..10000</a> %e A371295 At the first step of A371282, to get from A371282(1)=1 to A371282(2)=2, we multiply by 2, so a(1)=2. %e A371295 At the fifth step of A371282, to get from A371282(5)=20 to A371282(6)=3, we subtract 17, so a(5)=-17. %o A371295 (Python) %o A371295 from itertools import islice %o A371295 def agen(): # generator of terms %o A371295 mina, an, aset, mink, kset = 1, 1, {1}, 1, set() %o A371295 while True: %o A371295 k1, ak1, k2 = 0, mina, mink %o A371295 if mina < an: %o A371295 for ak1 in range(mina, an-mink+1): %o A371295 if ak1 not in aset and an - ak1 not in kset: %o A371295 k1 = an - ak1 %o A371295 break %o A371295 while k2 in kset or an*k2 in aset: %o A371295 k2 += 1 %o A371295 an, k = (an-k1, k1) if k1 > 0 else (an*k2, k2) %o A371295 yield -k if k1 > 0 else k %o A371295 aset.add(an) %o A371295 kset.add(k) %o A371295 while mina in aset: mina += 1 %o A371295 while mink in kset: mink += 1 %o A371295 print(list(islice(agen(), 56))) # _Michael S. Branicky_, Mar 18 2024 %Y A371295 Cf. A371282, A099004 (steps of add or subtract), A360597 (steps of multiply or divide). %K A371295 sign %O A371295 1,1 %A A371295 _Neal Gersh Tolunsky_, Mar 17 2024 %E A371295 a(12) and beyond from _Michael S. Branicky_, Mar 18 2024