login
A381115
Composite terms in A381019 in order of appearance.
0
4, 9, 8, 6, 25, 12, 10, 49, 15, 16, 14, 27, 20, 21, 22, 18, 35, 24, 169, 28, 33, 26, 85, 32, 57, 77, 30, 34, 39, 55, 38, 51, 40, 91, 36, 121, 42, 65, 44, 45, 529, 48, 119, 46, 95, 81, 143, 50, 63, 52, 54, 115, 56, 841, 187, 69, 62, 125, 87, 64, 133, 75, 58, 221
OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..336
MATHEMATICA
nn = 500; c[_] = False; u = v = 2; a[1] = 1;
Monitor[Reap[
Do[k = u;
While[Or[c[k],
! CoprimeQ[k, Product[a[h], {h, n - Min[k, n - 1], n - 1}] ] ],
If[k > n - 1, k = v, k++]];
Set[{a[n], c[k]}, {k, True}];
If[CompositeQ[k], Sow[k]];
If[k == u, While[c[u], u++]];
If[k == v, While[Or[c[v], CompositeQ[v]], v++]], {n, 2, nn}] ][[-1, 1]], n] (* Michael De Vlieger, Feb 14 2025 *)
PROG
(Python)
from math import gcd
from sympy import isprime
from itertools import count, islice
def agen(): # generator of terms
alst, aset, an, m = [1], {1}, 1, 2
for n in count(2):
if an > 3 and not isprime(an):
yield an
an = next(k for k in count(m) if k not in aset and all(gcd(alst[-j], k) == 1 for j in range(1, min(k, n-1)+1)))
alst.append(an)
aset.add(an)
while m in aset: m += 1
print(list(islice(agen(), 64))) # Michael S. Branicky, Feb 14 2025
CROSSREFS
KEYWORD
nonn,new
AUTHOR
N. J. A. Sloane, Feb 14 2025
STATUS
approved