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 A377388 #10 Oct 28 2024 16:24:26 %S A377388 0,1,-2,-3,-5,-8,-6,-11,-13,-21,-16,9,-42,-24,-25,-27,-34,-35,-46,10, %T A377388 2,90,42,31,26,11,30,18,58,41,20,86,43,60,45,103,48,54,105,83,-48, %U A377388 -151,-155,-59,-87,-79,-146,106,-157,-109,-218,-208,-88,-45,-99,-131,27 %N A377388 Infinite sequence of integers a(1), a(2), ... such that for any n > 0, a(n) is as small as possible (in absolute value) and the means of consecutive terms are all distinct; in case of a tie, preference is given to the positive value. %C A377388 This sequence is a variant of A377351 allowing negative values. %C A377388 All terms are distinct. %H A377388 Rémy Sigrist, <a href="/A377388/b377388.txt">Table of n, a(n) for n = 1..10000</a> %H A377388 Rémy Sigrist, <a href="/A377388/a377388.txt">C++ program</a> %e A377388 The first terms, alongside the means of consecutive terms ending with a(n), are: %e A377388 n a(n) Corresponding means %e A377388 - ---- ----------------------------------------- %e A377388 1 0 0 %e A377388 2 1 1/2, 1 %e A377388 3 -2 -1/3, -1/2, -2 %e A377388 4 -3 -1, -4/3, -5/2, -3 %e A377388 5 -5 -9/5, -9/4, -10/3, -4, -5 %e A377388 6 -8 -17/6, -17/5, -9/2, -16/3, -13/2, -8 %e A377388 7 -6 -23/7, -23/6, -24/5, -11/2, -19/3, -7, -6 %o A377388 (C++) // See Links section. %o A377388 (Python) %o A377388 from fractions import Fraction %o A377388 from itertools import count, islice %o A377388 def A377388gen(): # generator of terms %o A377388 alst, means_seen = [0], {0} %o A377388 while True: %o A377388 yield alst[-1] %o A377388 for i in count(1): %o A377388 failed = True %o A377388 for k in [i, -i]: %o A377388 if k in means_seen: continue %o A377388 mk, failed, sk = {k}, False, k %o A377388 for j in range(1, len(alst)+1): %o A377388 sk += alst[-j] %o A377388 m = Fraction(sk, j+1) %o A377388 if m in means_seen or m in mk: failed = True; break %o A377388 mk.add(m) %o A377388 if not failed: %o A377388 means_seen |= mk %o A377388 alst.append(k) %o A377388 break %o A377388 if not failed: break %o A377388 print(list(islice(A377388gen(), 60))) # _Michael S. Branicky_, Oct 27 2024, Oct 28 2024 %Y A377388 Cf. A377351, A377389. %K A377388 sign %O A377388 1,3 %A A377388 _Rémy Sigrist_, Oct 27 2024