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.

A025582 A B_2 sequence: a(n) is the least value such that sequence increases and pairwise sums of elements are all distinct.

Original entry on oeis.org

0, 1, 3, 7, 12, 20, 30, 44, 65, 80, 96, 122, 147, 181, 203, 251, 289, 360, 400, 474, 564, 592, 661, 774, 821, 915, 969, 1015, 1158, 1311, 1394, 1522, 1571, 1820, 1895, 2028, 2253, 2378, 2509, 2779, 2924, 3154, 3353, 3590, 3796, 3997, 4296, 4432, 4778, 4850
Offset: 1

Views

Author

Keywords

Comments

a(n) is also the least value such that sequence increases and pairwise differences of distinct elements are all distinct.

Examples

			After 0, 1, a(3) cannot be 2 because 2+0 = 1+1, so a(3) = 3.
		

Crossrefs

Row 2 of A365515.
See A011185 for more information.
A010672 is a similar sequence, but there the pairwise sums of distinct elements are all distinct.

Programs

  • Python
    from itertools import count, islice
    def A025582_gen(): # generator of terms
        aset1, aset2, alist = set(), set(), []
        for k in count(0):
            bset2 = {k<<1}
            if (k<<1) not in aset2:
                for d in aset1:
                    if (m:=d+k) in aset2:
                        break
                    bset2.add(m)
                else:
                    yield k
                    alist.append(k)
                    aset1.add(k)
                    aset2 |= bset2
    A025582_list = list(islice(A025582_gen(),20)) # Chai Wah Wu, Sep 01 2023
  • Sage
    def A025582_list(n):
        a = [0]
        psums = set([0])
        while len(a) < n:
            a += [next(k for k in IntegerRange(a[-1]+1, infinity) if not any(i+k in psums for i in a+[k]))]
            psums.update(set(i+a[-1] for i in a))
        return a[:n]
    print(A025582_list(20))
    # D. S. McNeil, Feb 20 2011
    

Formula

a(n) = A005282(n) - 1. - Tyler Busby, Mar 16 2024