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.

A359857 a(1) = 1, a(2) = 2, and let i,j represent a(n-2), a(n-1) respectively. For n > 2: If only one of i,j is prime, a(n) = least novel multiple of i+j. If i,j are both prime, a(n) = least novel multiple of i*j. If both i,j are nonprime, a(n) is least novel k prime to both i and j.

This page as a plain text file.
%I A359857 #14 Jan 16 2023 11:10:28
%S A359857 1,2,3,6,9,5,14,19,33,52,7,59,413,472,11,483,494,17,511,528,13,541,
%T A359857 7033,7574,15,23,38,61,99,160,29,189,218,25,21,4,31,35,66,37,103,3811,
%U A359857 3914,27,41,68,109,177,286,43,329,372,53,425,478,39,47,86,133,45,8
%N A359857 a(1) = 1, a(2) = 2, and let i,j represent a(n-2), a(n-1) respectively. For n > 2: If only one of i,j is prime, a(n) = least novel multiple of i+j. If i,j are both prime, a(n) = least novel multiple of i*j. If both i,j are nonprime, a(n) is least novel k prime to both i and j.
%C A359857 A lexicographically earliest sequence. If the "least novel" restrictions on the first two conditions are removed the result is a sequence initially identical to this one, but eventually repeat terms occur, whereas in this constrained version there are no repeats. The plots appear to distinguish three distinct zones, corresponding to the conditions of the Name. The first (upper) relates to terms following the occurrence of two primes (i*j), the middle zone relates to the occurrence of a prime and a nonprime (i+j), and the third (lowest) refers to terms following the occurrence of consecutive nonprime terms, where the coprime condition introduces the least unused numbers, which are initially (until a(25) = 15) all primes. It is not clear if every positive integer appears, but this does seem likely (note the late appearance of 4 at a(36)).
%H A359857 Michael S. Branicky, <a href="/A359857/b359857.txt">Table of n, a(n) for n = 1..10000</a>
%e A359857 a(3) = 3 since only one of a(1), a(2) is prime and i+j = 3 has not occurred previously.
%e A359857 a(4) = 6 since a(2) = 2 and a(3) = 3 are both prime and i*j = 6 has not occurred previously.
%e A359857 a(6) = 5 since a(4) = 6 and a(5) = 9 are both composite, and 5 is the least novel number prime to both.
%o A359857 (Python)
%o A359857 from math import gcd
%o A359857 from sympy import isprime
%o A359857 from itertools import count, islice
%o A359857 def agen():
%o A359857     i, j, pi, pj, mink, aset = 1, 2, 0, 1, 3, {1, 2}
%o A359857     yield from [i, j]
%o A359857     while True:
%o A359857         if pi^pj:
%o A359857             k, m = max(mink//(i+j), 1), i+j
%o A359857             while m*k in aset: k += 1
%o A359857         elif pi&pj:
%o A359857             k, m = max(mink//(i*j), 1), i*j
%o A359857             while m*k in aset: k += 1
%o A359857         else:
%o A359857             k, m = mink, 1
%o A359857             while k in aset or gcd(k, i) != 1 or gcd(k, j) != 1: k += 1
%o A359857         an = m*k
%o A359857         i, j, pi, pj = j, an, pj, int(isprime(an)); yield an; aset.add(an)
%o A359857         while mink in aset: mink += 1
%o A359857 print(list(islice(agen(), 36))) # _Michael S. Branicky_, Jan 16 2023
%Y A359857 Cf. A359256, A359557.
%K A359857 nonn
%O A359857 1,2
%A A359857 _David James Sycamore_, Jan 16 2023
%E A359857 a(31)=29 inserted and a(38) and beyond from _Michael S. Branicky_, Jan 16 2023