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.

This page as a plain text file.
%I A249559 #16 Sep 10 2024 18:42:35
%S A249559 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,
%T A249559 71,25,27,73,79,83,89,97,101,103,107,109,113,121,127,91,131,137,139,
%U A249559 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
%N A249559 Same definition as A247665, except first term is 3.
%o A249559 (SageMath) # from _Nadia Heninger_, Oct 28 2014: s is the starting point (2 in A247665, 3 here).
%o A249559 def gen(s):
%o A249559     sequence = [s]
%o A249559     available = range(2, 2*s)
%o A249559     available.pop(available.index(s))
%o A249559     yield s
%o A249559     while True:
%o A249559         available.extend(range(available[-1]+1, next_prime(available[-1])+1))
%o A249559         for i, e in enumerate(available):
%o A249559             if all([gcd(e, sequence[j])==1 for j in range(-len(sequence)/2, 0)]):
%o A249559                 available.pop(i)
%o A249559                 sequence.append(e)
%o A249559                 yield(e)
%o A249559                 break
%o A249559 g = gen(3)
%o A249559 [g.next() for i in range(40)] # gets first 40 terms
%o A249559 (Python)
%o A249559 from itertools import count, islice
%o A249559 from math import gcd
%o A249559 from collections import deque
%o A249559 def A249559_gen(): # generator of terms
%o A249559     aset, aqueue, c, f = {3}, deque([3]), 2, True
%o A249559     yield 3
%o A249559     while True:
%o A249559         for m in count(c):
%o A249559             if m not in aset and all(gcd(m,a) == 1 for a in aqueue):
%o A249559                 yield m
%o A249559                 aset.add(m)
%o A249559                 aqueue.append(m)
%o A249559                 if f: aqueue.popleft()
%o A249559                 f = not f
%o A249559                 while c in aset:
%o A249559                     c += 1
%o A249559                 break
%o A249559 A249559_list = list(islice(A249559_gen(),50)) # _Chai Wah Wu_, May 19 2022
%Y A249559 Cf. A247665.
%K A249559 nonn
%O A249559 1,1
%A A249559 _N. J. A. Sloane_, Nov 02 2014