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.

A249559 Same definition as A247665, except first term is 3.

Original entry on oeis.org

3, 2, 5, 7, 4, 9, 11, 13, 17, 19, 8, 23, 15, 29, 31, 37, 41, 43, 47, 49, 53, 59, 16, 61, 67, 71, 25, 27, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 121, 127, 91, 131, 137, 139, 149, 151, 32, 157, 163, 167, 173, 179, 181, 191, 85, 193, 57, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263
Offset: 1

Views

Author

N. J. A. Sloane, Nov 02 2014

Keywords

Crossrefs

Cf. A247665.

Programs

  • Python
    from itertools import count, islice
    from math import gcd
    from collections import deque
    def A249559_gen(): # generator of terms
        aset, aqueue, c, f = {3}, deque([3]), 2, True
        yield 3
        while True:
            for m in count(c):
                if m not in aset and all(gcd(m,a) == 1 for a in aqueue):
                    yield m
                    aset.add(m)
                    aqueue.append(m)
                    if f: aqueue.popleft()
                    f = not f
                    while c in aset:
                        c += 1
                    break
    A249559_list = list(islice(A249559_gen(),50)) # Chai Wah Wu, May 19 2022
  • SageMath
    # from Nadia Heninger, Oct 28 2014: s is the starting point (2 in A247665, 3 here).
    def gen(s):
        sequence = [s]
        available = range(2, 2*s)
        available.pop(available.index(s))
        yield s
        while True:
            available.extend(range(available[-1]+1, next_prime(available[-1])+1))
            for i, e in enumerate(available):
                if all([gcd(e, sequence[j])==1 for j in range(-len(sequence)/2, 0)]):
                    available.pop(i)
                    sequence.append(e)
                    yield(e)
                    break
    g = gen(3)
    [g.next() for i in range(40)] # gets first 40 terms