A375802 Lexicographically earliest sequence of positive integers such that the sum of the inverses of the indices where the sequence has the same value is at most 1.
1, 2, 2, 3, 3, 2, 3, 3, 3, 3, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6
Offset: 1
Examples
The first terms, alongside the sums of the inverses of the indices so far where the sequence has the same value, are: n a(n) Sums -- ---- --------- 1 1 1 2 2 1/2 3 2 5/6 4 3 1/4 5 3 9/20 6 2 1 7 3 83/140 8 3 201/280 9 3 2089/2520 10 3 2341/2520
Links
Programs
-
PARI
{ b = vector(6); for (n = 1, 87, for (v = 1, oo, if (b[v] + 1/n <= 1, b[v] += 1/n; print1 (v", "); break;););); }
-
Python
from fractions import Fraction from itertools import count, islice from collections import defaultdict def agen(): # generator of terms invsum, mink = defaultdict(int), 1 for n in count(1): an = next(k for k in count(mink) if invsum[k] + Fraction(1, n) <= 1) yield an invsum[an] += Fraction(1, n) while invsum[mink] == 1: mink += 1 print(list(islice(agen(), 87))) # Michael S. Branicky, Aug 31 2024
Comments