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.

A381019 a(n) is the smallest positive integer not yet in the sequence such that a(n) is relatively prime to a(n-i) for all 1 <= i <= min(a(n), n-1).

Original entry on oeis.org

1, 2, 3, 5, 7, 11, 4, 13, 17, 19, 23, 29, 9, 31, 37, 8, 41, 43, 47, 53, 59, 61, 6, 67, 71, 73, 79, 83, 89, 25, 97, 101, 103, 107, 109, 12, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 10, 173, 179, 181, 191, 193, 197, 199, 49, 211, 223, 227, 229, 233
Offset: 1

Views

Author

Ali Sada and Allan C. Wechsler, Feb 12 2025

Keywords

Comments

Theorem (Russ Cox, Feb 14-16, 2025): Every positive number will eventually appear. For proof see link.
Jinyuan Wang (Feb 16, 2025) has informed us that he also proved that every number appears.

Examples

			After a(2)=2, the next term that shares a common factor with 2 is a(7)=4, which is permitted since the difference 7-2 = 5 is greater than 4.
		

Crossrefs

A381167 is a different but closely related sequence.

Programs

  • Maple
    N:= 1000: # for terms before the first term > N
    Cands:= [$2..N]: R:= [1]: x:= 1:
    for n from 2 do
      found:= false;
      for j from 1 to N - n do
        if andmap(t -> igcd(t, Cands[j]) = 1, [seq(R[n-i],i=1 .. min(Cands[j],n-1))]) then
          found:= true; x:= Cands[j]; R:= [op(R),x]; Cands:= subsop(j=NULL,Cands); break
        fi od:
      if not found then break fi
    od:
    R; # Robert Israel, Feb 14 2025
  • Mathematica
    nn = 120; c[_] = False; u = v = 2; a[1] = 1;
    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[k == u, While[c[u], u++]];
      If[k == v, While[Or[c[v], CompositeQ[v]], v++]], {n, 2, nn}];
    Array[a, nn] (* Michael De Vlieger, Feb 14 2025 *)
  • Python
    # see link for faster version
    from math import gcd
    from itertools import count, islice
    def agen(): # generator of terms
        alst, aset, an, m = [1], {1}, 1, 2
        for n in count(2):
            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(), 61))) # Michael S. Branicky, Feb 13 2025

Extensions

More terms from Michael S. Branicky, Feb 13 2025

A381120 Numbers k such that both A381019(k) and A381019(k+1) are composite.

Original entry on oeis.org

63, 630, 2423, 5653, 9104, 26308, 36108, 41622, 64526, 85121, 108917, 143913, 148305, 176405, 316974, 399168, 399907, 406487, 536926, 621016, 830793, 937038, 937109, 970243, 1088629, 1480545, 1895503, 3961587, 4651102, 5171081, 5487450, 6219705, 7327856, 8118740
Offset: 1

Views

Author

N. J. A. Sloane, Feb 15 2025

Keywords

Comments

Initially, A381019 consists of runs of primes separated by single composite numbers. These indices k mark the beginning of two or more consecutive composite numbers in A381019.

Crossrefs

Cf. A381019, A379810 (the values of A381019(k)).

Programs

  • PARI
    lista(nn) = my(c, f, m=1, q=1, r=0, t, u=List([]), w=vector(nn)); for(n=2, nn, t=0; forprime(p=2, max(m, sqrtint(n)), c=n-1-w[p]; if(c>1&&!w[c], listput(u, c))); listsort(u, 1); for(i=1, #u, c=u[i]; f=factor(c)[, 1]; t=1; for(j=1, #f, if(n-c<=w[f[j]], t=0; break)); if(t, u=u[i+1..#u]; if(r, print1(n-1, ", ")); r=1; w[c]=1; for(j=1, #f, w[f[j]]=n); m=max(m, f[#f]); break)); if(!t, r=0; u=List([]); if(nn>q=nextprime(q+1), w[q]=n))); \\ Jinyuan Wang, Feb 16 2025

Extensions

a(7)-a(8) from Michael De Vlieger, Feb 15 2025
a(9)-a(34) from Jinyuan Wang, Feb 16 2025
Showing 1-2 of 2 results.