cp's OEIS Frontend

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.

A377351 Lexicographically earliest sequence of positive integers such that the means of consecutive terms are all distinct.

This page as a plain text file.
%I A377351 #11 Oct 28 2024 16:24:40
%S A377351 1,2,4,7,5,10,12,18,13,16,28,23,14,25,48,32,17,46,30,45,67,60,27,71,
%T A377351 39,85,68,99,78,44,102,87,126,57,118,69,121,74,125,119,112,136,107,
%U A377351 110,170,120,175,142,194,75,222,152,164,180,177,184,188,135,255,210
%N A377351 Lexicographically earliest sequence of positive integers such that the means of consecutive terms are all distinct.
%C A377351 In other words, for any distinct nonempty intervals t..u and v..w, Sum_{i = t..u} a(i)/(u-t+1) <> Sum_{j = v..w} a(j)/(w-v+1).
%C A377351 This sequence corresponds essentially to the first differences of A033808.
%C A377351 By necessity, all terms are distinct.
%H A377351 Rémy Sigrist, <a href="/A377351/b377351.txt">Table of n, a(n) for n = 1..10000</a>
%H A377351 Rémy Sigrist, <a href="/A377351/a377351.txt">C++ program</a>
%F A377351 a(n) = A033808(n) - A033808(n-1).
%e A377351 The first terms, alongside the means of consecutive terms ending with a(n), are:
%e A377351   n  a(n)  Corresponding means
%e A377351   -  ----  ------------------------------------------
%e A377351   1     1  1
%e A377351   2     2  3/2, 2
%e A377351   3     4  7/3, 3, 4
%e A377351   4     7  7/2, 13/3, 11/2, 7
%e A377351   5     5  19/5, 9/2, 16/3, 6, 5
%e A377351   6    10  29/6, 28/5, 13/2, 22/3, 15/2, 10
%e A377351   7    12  41/7, 20/3, 38/5, 17/2, 9, 11, 12
%e A377351   8    18  59/8, 58/7, 28/3, 52/5, 45/4, 40/3, 15, 18
%o A377351 (C++) // See Links section.
%o A377351 (Python)
%o A377351 from fractions import Fraction
%o A377351 from itertools import count, islice
%o A377351 def agen(): # generator of terms
%o A377351     alst, means_seen = [1], {1}
%o A377351     while True:
%o A377351         yield alst[-1]
%o A377351         for k in count(1):
%o A377351             if k in means_seen: continue
%o A377351             mk, failed, sk = {k}, False, k
%o A377351             for j in range(1, len(alst)+1):
%o A377351                 sk += alst[-j]
%o A377351                 m = Fraction(sk, j+1)
%o A377351                 if m in means_seen or m in mk: failed = True; break
%o A377351                 mk.add(m)
%o A377351             if not failed: break
%o A377351         means_seen |= mk
%o A377351         alst.append(k)
%o A377351 print(list(islice(agen(), 60))) # _Michael S. Branicky_, Oct 26 2024, Oct 28 2024
%Y A377351 Cf. A033808, A377388.
%K A377351 nonn
%O A377351 1,2
%A A377351 _Rémy Sigrist_, Oct 26 2024