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.

Showing 1-2 of 2 results.

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

Original entry on oeis.org

1, 2, 3, 5, 8, 13, 21, 30, 39, 53, 74, 95, 128, 152, 182, 212, 258, 316, 374, 413, 476, 531, 546, 608, 717, 798, 862, 965, 1060, 1161, 1307, 1386, 1435, 1556, 1722, 1834, 1934, 2058, 2261, 2497, 2699, 2874, 3061, 3197, 3332, 3629, 3712, 3868, 4140, 4447, 4640
Offset: 1

Views

Author

Keywords

Comments

a(n) = least positive integer > a(n-1) and not equal to a(i)+a(j)-a(k) for distinct i and j with 1 <= i,j,k <= n-1. [Comment corrected by Jean-Paul Delahaye, Oct 02 2020.]

Crossrefs

Programs

  • Python
    from itertools import islice
    def agen(): # generator of terms
        aset, sset, k = set(), set(), 0
        while True:
            k += 1
            while any(k+an in sset for an in aset): k += 1
            yield k; sset.update(k+an for an in aset); aset.add(k)
    print(list(islice(agen(), 51))) # Michael S. Branicky, Feb 05 2023

Formula

a(n) = A010672(n-1)+1.

A133096 a(n) = A079848(n) - A062294(n).

Original entry on oeis.org

0, 0, 0, 4, 12, 20, 18, 50, 34, 66, 80, 70, 120, 76, 90, 198, 140, 70, 110, 156, 100, 164, 10, -6, 198, 66, 258, 280, 732, 390, 594, 342, 270, 314, 210, 402, 252, 246, -28, -204, -224, 234, 14, 528, 500, 850, 1110, 942, 1014, 1542, 1906, 1416, 1034, 1454, 970, 982, 1518
Offset: 1

Views

Author

Klaus Brockhaus, Sep 17 2007

Keywords

Comments

A079848 is the sequence of smallest primes such that the pairwise sums of not necessarily distinct elements are all distinct, whereas A062294 is the sequence of smallest primes such that the pairwise sums of distinct elements are all distinct.

Examples

			a(6) = A079848(6) - A062294(6) = 37 - 17 = 20.
		

Crossrefs

Programs

  • Python
    from collections import deque
    from itertools import islice
    from sympy import nextprime
    def A133096_gen(): # generator of terms
        aset2, alist, bset2, blist, aqueue, bqueue, k = set(), [], set(), [], deque(), deque(), 1
        while (k:=nextprime(k)):
            cset2 = set()
            for a in alist:
                if (m:=k-a) in aset2:
                    break
                cset2.add(m)
            else:
                aqueue.append(k)
                alist.append(k)
                aset2.update(cset2)
            cset2 = set()
            for b in blist:
                if (m:=b+k) in bset2:
                    break
                cset2.add(m)
            else:
                bqueue.append(k)
                blist.append(k)
                bset2.update(cset2)
            if len(aqueue) > 0 and len(bqueue) > 0:
                yield aqueue.popleft()-bqueue.popleft()
    A133096_list = list(islice(A133096_gen(),30)) # Chai Wah Wu, Sep 11 2023
Showing 1-2 of 2 results.